摘要: 题目链接普通的DFS。 1 #include <stdio.h> 2 #include <string.h> 3 char p[5][5]; 4 int max,o[5][5],n; 5 int judge(int x,int y) 6 { 7 int i,z = 1; 8 for(i = x+1;i <= n-1;i ++) 9 { 10 if(o[i][y] == 2) 11 { 12 z = 0; 13 break; 14 } 15 e... 阅读全文
posted @ 2012-07-20 21:13 Naix_x 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目链接暴力水过的方式是多样化的。。 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 #include <stdlib.h> 5 #define eps 0.000000001 6 int p[5],n,m,num; 7 struct tri 8 { 9 int a,b,c,d;10 }o[100001];11 int cmp(const void *a,const void *b)12 {13 struct tri *p = (struct tri*)a;14 s 阅读全文
posted @ 2012-07-20 16:39 Naix_x 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 题目链接题目 都没看,直接看样例,直接拍代码,1Y。 1 #include <stdio.h> 2 #include <string.h> 3 int p[101][101]; 4 int str1[101],str2[101]; 5 int main() 6 { 7 int i,j,n,m,num = 0; 8 while(scanf("%d%d",&n,&m)!=EOF) 9 {10 if(!n && !m)break;11 num ++;12 memset(p,0,sizeof(p));13 for(... 阅读全文
posted @ 2012-07-20 15:27 Naix_x 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目链接继续水过。。。 1 #include <stdio.h> 2 #include <string.h> 3 #define N 30010 4 #define eps 0.00000001 5 long long p1[N],p2[N]; 6 int main() 7 { 8 int a[6] = {1,5,10,25,50}; 9 int i,j,k,n;10 p1[0] = 1;11 for(i = 0; i <= 4; i ++)12 {13 for(j = 0; j <= 30000; j ++)14 {1... 阅读全文
posted @ 2012-07-20 14:29 Naix_x 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题目链接和POJ2406差不多,不过用暴力去找,会超时。 1 #include <stdio.h> 2 #include <string.h> 3 #include <math.h> 4 #define N 1000001 5 char str[N]; 6 int next[N]; 7 int main() 8 { 9 int i,j,len,d,a = 0;10 while(scanf("%d%*c",&len)!=EOF)11 {12 a ++;13 if(len == 0)break;14 scanf("%s&qu 阅读全文
posted @ 2012-07-20 13:44 Naix_x 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接预处理改一下,就OK了。。。我竟然敲错模版了。。。3Y。一种是暴力,一种更巧妙。直接取余判断 1 #include <stdio.h> 2 #include <string.h> 3 #define N 1000001 4 char str[N]; 5 int next[N]; 6 int main() 7 { 8 int i,j,len,d; 9 while(scanf("%s",str)!=EOF)10 {11 if(str[0] == '.')break;12 len = strlen(str);13 nex... 阅读全文
posted @ 2012-07-20 11:08 Naix_x 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题目链接第一个KMP,纪念纪念。。。虽然比着模版打的,理解模版,真的好短。 1 #include <stdio.h> 2 #include <string.h> 3 char str1[10001],str2[1000001]; 4 int next[10001]; 5 int main() 6 { 7 int t,len1,len2,num,i,j; 8 scanf("%d",&t); 9 while(t--)10 {11 scanf("%s%s",str1,str2);12 len1 = strlen(str1);13 阅读全文
posted @ 2012-07-20 10:12 Naix_x 阅读(135) 评论(0) 推荐(0) 编辑