上一页 1 2 3 4 5 6 ··· 16 下一页
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 10001 5 6 int f[N], value[3]; 7 int main() 8 { 9 int i, j, V, ncases;10 11 scanf("%d", &ncases); 12 while( ncases-- )13 { 14 scanf("%d",&V); 15 value[0] = 150;16 ... 阅读全文
posted @ 2012-08-21 09:42 zhongya 阅读(116) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 6 int a[125][125]; 7 8 int main() 9 { 10 int n, i, j, k, num; 11 12 while( scanf("%d",&n) != EOF)13 {14 memset(a,0,sizeof(a)); 15 for(i=0; i<=n; i++)16 {17 a[i... 阅读全文
posted @ 2012-08-21 09:11 zhongya 阅读(131) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 #define N 1000000 6 7 long long a[N]; 8 int gcd(int n,int m) 9 {10 if(m == 0)11 return n;12 else13 return gcd(m,n%m); 14 }15 16 int Lcm(int a,int b)17 {18 return a/gcd(a,b)*b;//... 阅读全文
posted @ 2012-08-21 09:10 zhongya 阅读(132) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 char s[1001]; 6 int Roots(int x) 7 { 8 int num=0,i; 9 while( x )10 {11 num += x%10;12 x /= 10;13 } 14 if(num < 10) 15 return num;16 else17 return Roots(num); 18 } 19... 阅读全文
posted @ 2012-08-18 16:56 zhongya 阅读(138) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 3 int main() 4 { 5 int n; 6 7 while(scanf("%d",&n)!=EOF) 8 { 9 if((n+2)%4 == 0)10 printf("yes\n");11 else12 printf("no\n"); 13 } 14 15 return 0;16 } 首先不能打表,数据量太大即使long long 也无法存下... 阅读全文
posted @ 2012-08-18 16:55 zhongya 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 一开始一直纠结在Yi + Yj <= L (1 ≤ i < j ≤ m)这句,后来在网上搜了下,恍然大悟啊!原来如此简单,所选取的每个数最多只有一个大于L/2(看到这我想你就会做了,太关键了),只要每次枚举判断小于L/2就把count++,最后不要忘了把大于L/2的最小值和小于L/2的最大值想加判断一下,小于L/2就count++;View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 long long n, L, A, B, mod, max, min,x,len; 阅读全文
posted @ 2012-08-18 11:08 zhongya 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 比赛是木做出来,回头看看,是当时考虑的太复杂了,si = si-1 + dk or si = si-1 - dk , and si-2 < si<= n, 1 <= k <= m, i >= 3相减的不会去取,每次都加上个dView Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int i, k, d, ncases; 7 int n, m, dmin; 8 9 scanf("%d", &ncases); 10 for(k = 阅读全文
posted @ 2012-08-18 11:01 zhongya 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 在草稿纸上算了半天,结果搜到了公式我了个去啊!搞ACM的数学不好真是太。。。。View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<math.h> 4 5 int main() 6 { 7 int i,j,ncases,num,count; 8 double sum; 9 10 scanf("%d",&ncases);11 while( ncases-- )12 { 13 scanf("%d",&num); 14 sum = 0.0; 阅读全文
posted @ 2012-08-17 10:57 zhongya 阅读(136) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int a,b,n,m,count,ncases; 7 int N; 8 scanf("%d",&N); 9 while( N-- )10 {11 ncases = 1; 12 while(scanf("%d%d",&n,&m))13 {14 if(n==0 && m==0) break; 1... 阅读全文
posted @ 2012-08-17 10:51 zhongya 阅读(160) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 1005 5 6 typedef struct 7 { 8 char s[15]; 9 int count;10 }Color;11 Color C[N];12 13 int cmp(const void *a,const void *b)14 {15 if( (*(Color *)a).count > (*(Color *)b).count)16 return 1;17 ret... 阅读全文
posted @ 2012-08-17 10:48 zhongya 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 16 下一页