摘要:
#include
#include
using namespace std;
typedef struct point
{ double x,y; point(double x=0.0,double y=0.0):x(x),y(y){}
}vector;
point p[1000010],c;
vector operator - (point a,point b) {return vector(a.x-b.x,a.y-b.y);}
point operator + (point a,point b) {return point(a.x+b.x,a.y+b.y);}
point ... 阅读全文
摘要:
#include
__int64 gcd(__int64 a,__int64 b)
{ return b==0?a:gcd(b,a%b); }
int main()
{ int i,j,prime[]={2,3,5,7,11,13,17,19},n,t; __int64 s1,s2,m,d,gd; while(scanf("%d",&n)==1) { s2=1;s1=0;t=0; if(n==21 || n==22) { for(i=2;id) {
... 阅读全文
摘要:
// Time 1062 ms, Memory 4252K#include
#include
int map[1010][1010],vis[1010],a[1010],b[1010],k;
int f1(int u)
{ int v; for(v=0;v<k;v++) { if(map[u][v] && !vis[v]) { vis[v]=1; if(!b[v] || f1(b[v])) { a[u]=v;b[v]=u;return ... 阅读全文
摘要:
// Time 0ms, Memory 356K#include
#include
#include
using namespace std;
int n,m,p[9][9],sx,sy,dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct point
{ int x,y,time,step; point(int x=0,int y=0,int time=0,int step=0):x(x),y(y),time(time),step(step){}
};
int bfs()
{ point s(sx,sy,6,0),t; queueq;... 阅读全文
摘要:
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents by---cxlove做了几个非常基础的数位DP,很水。弱爆了,接下来要进行进阶训练了HDU 2089 不要62http://acm.hdu.edu.cn/showproblem.php?pid=2089不能出现4,或者相邻的62,这题可以暴力打表解决具体的在代码里都有解释#include #include #include #include #include #include #define N 55 #define inf 14) //高位可... 阅读全文
摘要:
//Time 0ms, Memory 288K#include
#include
int main()
{ int i,j,la,lb,t,map[20][20],dp[105][105],x,y,z; char a[105],b[105]; memset(map,0,sizeof(map)); map[0][0]=map[2][2]=map[6][6]=map[19][19]=5; map[0][2]=map[2][0]=map[0][19]=map[19][0]=map[7][19]=-1; map[0][6]=map[6][0]=map[2... 阅读全文