ACM/Topcoder
iteye_19635
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1018 Fibonacci I
http://acm.nit.net.cn/showproblem.jsp?pid=1018 这题我差点疯掉了,一直没错,最后才发现 yes 被我写成了Yes。 n 余数 0 1 1 2 2 0 3 2 4 2 5 1 6 0 7 1 8 1 9 2 10 0 可以看出规律,被4除余2即可被3整除。 #include <stdio.h> in...2008-12-12 11:17:17 · 107 阅读 · 0 评论 -
1016 七段显示
http://acm.nit.net.cn/showproblem.jsp?pid=1016 注意数字范围,数字与字符 转换如3与‘3’。 a[2]={1,2,3]; printf("%s",a); 是123 #include <stdio.h> #define BSIZE 36 void print_bin(int); int main() { char bi...2008-12-10 12:25:09 · 111 阅读 · 0 评论 -
1015 因式分解
http://acm.nit.net.cn/showproblem.jsp?pid=1015 #include <stdio.h> int fac[2046]; int factor(int); int main() { int a; while(scanf("%d", &a) == 1) { printf("%d=",a); int temp = fac...2008-12-09 22:53:11 · 118 阅读 · 0 评论 -
1014 素数个数
http://acm.nit.net.cn/showproblem.jsp?pid=1014 #include <stdio.h> #include <math.h> int is_prime(int); void swap(int *, int *); int main() { int a, b; int i; int num; while(scan...2008-12-09 10:55:02 · 142 阅读 · 0 评论 -
1013:兔子生崽
http://acm.nit.net.cn/showproblem.jsp?pid=1013 #include <stdio.h> int a[45]; int fib(int m); int main() { int month; while(scanf("%d",&month) == 1) { printf("%d\n",fib(month)); } re...2008-12-08 17:07:51 · 160 阅读 · 0 评论 -
解题报告:1012 给日期求第几天
http://acm.nit.net.cn/showproblem.jsp?pid=1012 #include <stdio.h> int isyunnian(int year); int monthtoday(int, int); int main() { int a, b, c; while(scanf("%d%d%d", &a, &b, &...2008-12-08 16:08:04 · 139 阅读 · 0 评论 -
problem 1011,求lcm
#include <stdio.h> #define type_t long long type_t gcb(type_t a, type_t b); type_t lcm(type_t a, type_t b); void swap1(type_t *, type_t *); int main() { type_t a, b; while(scanf("%lld%ll...2008-12-05 10:22:17 · 191 阅读 · 0 评论 -
problem 1010 ,求gcb
#include <stdio.h> int gcb(int a, int b); void swap(int * a, int * b); int main() { int a, b; while(scanf("%d%d",&a , &b) == 2) { printf("%d\n",gcb(a, b)); } return 0; } int...2008-12-05 09:44:13 · 119 阅读 · 0 评论 -
NIT,Problem2 Elephant
http://acm.nit.net.cn/showproblem.jsp?pid=1002 不知道为什么总是WA,测试没遇到问题。把代码贴在这里 #include <stdio.h> #define TOTAL 1000 int w[TOTAL]; int s[TOTAL]; int a[TOTAL]; int b[TOTAL]; int c[TOTAL]; int layer[...2008-12-05 09:09:45 · 117 阅读 · 0 评论 -
POJ1002
#include <iostream>#include <string>using namespace std;int myctoi(const char c);int a[10000000];int main(){ int N; cin>>N; string str; int num; while(N--) { num = 0; cin>>st...2009-11-06 15:14:38 · 159 阅读 · 0 评论 -
1023 士兵队列训练问题
#include <stdio.h> #include <stdlib.h> void soldier(int s[], int n) { int i, j; int m; m = n; int k = 2; while(m > 3) { j = 1; for(i = 0; i < n; i++) { if(s[i] ==...2008-12-29 22:05:37 · 136 阅读 · 0 评论 -
1026 验证角谷猜想
总是出现presentation 错误。。原来每行中只有两个输出之间才能有一个空格, #include <stdio.h> void verify(int n) { int flag = 0; while(n != 1) { if(n % 2 ==0) n = n / 2; else { if(flag != 0 ) printf(" "); p...2008-12-29 17:16:08 · 158 阅读 · 0 评论 -
1064 快乐竞赛,看MM升气球
差点又犯错误了,Odd又写成了odd #include <stdio.h> int main() { unsigned int num; while(scanf("%u", &num) == 1) { if(num % 2 == 0) printf("Even\n"); else printf("Odd\n"); } return 0; } ...2008-12-25 19:50:29 · 113 阅读 · 0 评论 -
1058 最大数
scanf 的输入格式,谁有给我传个。。 #include <stdio.h> #include <string.h> double a[50000]; double max(unsigned int); int main() { int casenum; int j; unsigned int n; unsigned int i; scanf("...2008-12-25 19:41:19 · 149 阅读 · 0 评论 -
1047 遗忘的数
#include <stdio.h> #include <string.h> int main() { int n; int num; int i; int flag[17] = {0} ; while(scanf("%d", &n) == 1) { memset(flag, 0, sizeof(flag)); for(i= 1; i <...2008-12-23 15:57:18 · 128 阅读 · 0 评论 -
1022 展开字符串(递归超时的)
/*http://acm.nit.net.cn/showproblem.jsp?pid=1022*/ #include <stdio.h> #include <ctype.h> #define MAXSIZE 250; char * unfoldstr(char *); int main() { int n, i; char str[250]; while(sc...2008-12-22 22:51:31 · 112 阅读 · 0 评论 -
1021 字符替换
#include <stdio.h> #include <string.h> #define MAX 256 int str_replace(char *str, size_t n, const char *old, const char *new); char a[MAX], b[MAX], c[MA...2008-12-21 17:02:14 · 121 阅读 · 0 评论 -
1019 Fibonacci II
前段时间忙这考试,快考完了,继续坚持。 http://acm.nit.net.cn/showproblem.jsp?pid=1019 Fib问题,矩阵解法。注意数据范围 #include <stdio.h> #define NTYPE long long #define MTYPE int const int A[2][2] = {{1, 1}, {1, 0}}; ...2008-12-19 16:50:53 · 108 阅读 · 0 评论 -
1017 数字回文
http://acm.nit.net.cn/showproblem.jsp?pid=1017 数字回文 还是要注意边界 #include <stdio.h> #define MAXSIZE 20 int palindorme(char num[]); int main() { char num[MAXSIZE] = {0}; while(scanf("%s",num) == ...2008-12-10 13:26:27 · 141 阅读 · 0 评论
分享