上一页 1 2 3 4 5 6 ··· 13 下一页
摘要: http://poj.org/problem?id=1979DFS模板题. 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int W,H; 5 char map[22][22]; 6 int count=0; 7 bool check(int x,int y) 8 { 9 if(!(1<=x&&x<=H&&1<=y&&y<=W)) return false;10 return true;11 }12 阅读全文
posted @ 2013-02-14 09:23 linyvxiang 阅读(262) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1562只想问一句,还敢更坑么?每一行数据后都可能有多个空格。。 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 int m,n; 5 char map[102][102]; 6 void find(int *x,int *y) 7 { 8 int i,j; 9 for(i=1;i<=m;i++) 10 for(j=1;j<=n;j++)11 if(map[i][j]=='@') {12 ... 阅读全文
posted @ 2013-02-06 12:22 linyvxiang 阅读(160) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2231水题。 1 #include <stdio.h> 2 #include <algorithm> 3 using namespace std; 4 long long numbers[10002]; 5 int main() 6 { 7 int N; 8 while(scanf("%d",&N)!=EOF) { 9 int i;10 for(i=0;i<N;i++) 11 scanf("%lld",&numbers[i]);12 sort(numbe. 阅读全文
posted @ 2013-02-06 10:03 linyvxiang 阅读(167) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2081打表. 1 #include <stdio.h> 2 int numbers[500001]; 3 bool flags[500001*10]={false}; 4 int main() 5 { 6 int i; 7 numbers[0]=0; 8 flags[0]=true; 9 numbers[1]=1;10 flags[1]=true;11 for(i=2;i<=500000;i++) {12 if(numbers[i-1]-i>0&&(flags[numbers[... 阅读全文
posted @ 2013-02-06 09:48 linyvxiang 阅读(150) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1936简单题,没什么需要特别注意的。 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 char *q,*p,*r; 5 bool check(char ch,char *dst) 6 { 7 while(*dst) { 8 if(*dst==ch) { 9 r=dst+1;10 return true;11 }12 dst++;13 }14 ... 阅读全文
posted @ 2013-02-06 09:24 linyvxiang 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3077念完题目也知道这题需要递归,当为要求的10的整数幂时返回,否则按四舍五入,再将幂加1,继续递归。 1 #include <stdio.h> 2 #include <math.h> 3 #include <stdlib.h> 4 void trans(int *p,int base) 5 { 6 if((*p)<(int)pow(10,base)) return; 7 if((*p)==pow(10,base)) return; 8 if((*p)>pow(10,base)) { 9 .. 阅读全文
posted @ 2013-02-05 16:17 linyvxiang 阅读(155) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2305和2105一样的,练习库函数,注意itoa在g++下面是不存在的。 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <stack> 5 using namespace std; 6 int main() 7 { 8 int b; 9 char p[1020],m[10];10 while(scanf("%d",&b)!=EOF) {11 if(b==0) r 阅读全文
posted @ 2013-02-05 15:55 linyvxiang 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2105看到有人写的博文,才知道的这个库函数,用一下,确实好用~strtol: string to long int 第一个参数为要转换的字符串的指针,第二个一般不用,为出错时返回的二级指针,第三个为字符串中数字的基数,而且对于大小写字母通吃. 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int main() 5 { 6 char str[10]; 7 int N; 8 while(scanf("%d&quo 阅读全文
posted @ 2013-02-05 15:30 linyvxiang 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 师父 师姐 爱你们 不要走 阅读全文
posted @ 2012-11-11 23:00 linyvxiang 阅读(109) 评论(0) 推荐(0) 编辑
摘要: http://pat.zju.edu.cn/contests/pat-practise/1007老的不能再老的问题 1 #include <stdio.h> 2 int K; 3 int num[10003]; 4 int sum[10003]; 5 int max_sum; 6 int main() 7 { 8 bool all_negative=true; 9 int start=0,end=0,cur_start=0,cur_end=0;10 scanf("%d",&K);11 int i;12 for(i=0;i<K;i++) {13 .. 阅读全文
posted @ 2012-06-30 16:59 linyvxiang 阅读(300) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 13 下一页