摘要: 1 #include 2 #include 3 #define MAXN 26 4 using namespace std; 5 6 int dx[]={-1,1,-2,2,-2,2,-1,1}; 7 int dy[]={-2,-2,-1,-1,1,1,2,2}; 8 int vis[MAXN][MAXN]; 9 int lu[MAXN][MAXN];10 int p,q;11 bool flag;12 13 void dfs(int i,int j,int step)14 {15 int x,y;16 vis[i][j]=step;17 ... 阅读全文
posted @ 2013-08-26 18:33 null1019 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #define MAXN 40 8 using namespace std; 9 10 char map[MAXN][MAXN][MAXN];11 bool vis[MAXN][MAXN][MAXN];12 int s[][10]= {{1,0,0},{-1,0,0},{0,1,0},{0,-1,0},{0,0,1},{0,0,-1}};13 int ex,ey,ez,sx,sy,sz,zz,yy,xx,l,r,c,k;14 struct node15 {1. 阅读全文
posted @ 2013-08-26 10:33 null1019 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #define MAXN 100001 6 using namespace std; 7 8 const int mod=99991; 9 int sum[MAXN][30]; 10 int f[MAXN][30]; 11 int c[MAXN][30]; 12 int n,k,len; 13 struct node 14 { 15 int xx; 16 node *next; 17 }; 18 node *hash[mod]; 19 20 bool cmp(i... 阅读全文
posted @ 2013-08-24 20:30 null1019 阅读(201) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2513 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int sign_node=26; 7 const int max_node=550000; 8 int f[max_node]; 9 int du[max_node];10 int num=0;11 int ch[max_node][sign_node];12 int val[max_node];13 14 struct Trie15 {16 int sz;17 void clear... 阅读全文
posted @ 2013-08-23 16:56 null1019 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2533 1 #include 2 #include 3 #include 4 using namespace std; 5 #define max 1000 6 int s[max+10]; 7 int max1[max+10]; 8 int main() 9 {10 int n,m;11 cin>>n;12 for(int i=1;i>s[i];15 }16 max1[1]=1;17 for(int i=2;is[j])23 {24 i... 阅读全文
posted @ 2013-08-21 23:56 null1019 阅读(164) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3126 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct node 7 { 8 int k,step; 9 };10 11 node h[100000];12 bool p[11000];13 int x,y,tot,s[11000];14 15 void make(int n)16 {17 memset(p,0,sizeof(p));18 p[0]=1;19 p[1]=1;20 for(int i=2; i>tot... 阅读全文
posted @ 2013-08-21 17:10 null1019 阅读(171) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2418 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 char s[10000]; 9 int main(){10 11 //freopen("sb.txt","r",stdin);12 long long cnt=0;13 mapq;14 while(gets(s))15 {16 cnt++;17 if(q.find(s)==q.end())18 ... 阅读全文
posted @ 2013-08-21 10:44 null1019 阅读(158) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1094 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 const int maxn=100000+5; 10 vector g[maxn]; 11 int du[maxn],n,m,l[maxn]; 12 bool vis[1000][1000]; 13 int toposort() 14 { 15 memset(du,0,sizeof(du)); 16 ... 阅读全文
posted @ 2013-08-20 23:15 null1019 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1840 1 #include 2 #include 3 #include 4 #define MAXN 25000001 5 using namespace std; 6 short a[MAXN]; 7 int main() 8 { 9 int a1,a2,a3,a4,a5;10 scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5);11 memset(a,0,sizeof(a));12 for(int x3=-50; x3 2 #include 3 # 阅读全文
posted @ 2013-08-20 16:18 null1019 阅读(113) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2442用STL写的时间为:5657MS 1 #include 2 #include 3 #include 4 #define MAXN 2005 5 using namespace std; 6 int main() 7 { 8 int t,n,m,c; 9 scanf("%d",&t);10 while(t--){11 scanf("%d%d",&n,&m);12 int a[MAXN];13 priority_queue,greater >q;14 priorit.. 阅读全文
posted @ 2013-08-20 12:32 null1019 阅读(244) 评论(0) 推荐(0) 编辑