摘要: 在草稿纸上算了半天,结果搜到了公式我了个去啊!搞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) 编辑
摘要: 比赛时这道题没做出来,后来在网上搜了一种简单的方法,把0,1,2,。。。。20,30,。。90存到一个数组里,n1,n2,n3代表每三位的数,刚开始自动匹配,n3开始计算,遇到million,thousand,hundred,再乘以10^n最后把n1,n2,n3加在一起就是所求结果。View Code 1 #include<stdlib.h> 2 #include<stdio.h> 3 #include<string.h> 4 5 char str[28][15]={"zero", "one", "two&q 阅读全文
posted @ 2012-08-17 08:17 zhongya 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 刚开始题意理解错了,好吧!无情的奉献了一次WA,去网上搜了下,这才把题意完全弄明白,N个人站成一排,每次奇数位或是偶数位出列,直到最后剩下的数的个数小于等于3,求总共有多少种方法View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int find(int n) 5 { 6 if(n < 3 ) return 0; 7 else if(n == 3) return 1; 8 else 9 {10 if(n%2 == 0) 11 return find(n/2)*2;... 阅读全文
posted @ 2012-08-17 08:11 zhongya 阅读(168) 评论(0) 推荐(0) 编辑