上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1562找出(1) x % a = 0;,然后用a作为递增的量,x为初始量View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a,b,t,c,x,i; 5 scanf("%d",&t); 6 while(t--) 7 { 8 scanf("%d%d%d",&a,&b,&c); 9 for(x=1000;;x++)10 if(x%a==0)11 break;... 阅读全文
posted @ 2013-04-19 23:43 执着追求的IT小小鸟 阅读(180) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1570数字较小,打表,然后,过View Code 1 #include<stdio.h> 2 int main() 3 { 4 int i,a[20],n,m,t,ans; 5 char s[3]; 6 a[1]=a[0]=1; 7 for(i=2;i<=10;i++) 8 a[i]=a[i-1]*i; 9 scanf("%d",&t);10 gets(s);11 while(t--)12 {13 scanf("%s%d%d",&s,& 阅读全文
posted @ 2013-04-19 21:35 执着追求的IT小小鸟 阅读(115) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2131简单逐个匹配就可以了View Code 1 #include<stdio.h> 2 #include<string.h> 3 char tw(char a) 4 { 5 if(a>='A'&&a<='Z') 6 return (a+32); 7 return a; 8 } 9 int main()10 {11 char a,s[201],b[20];12 int j;13 double i,sum;14 while(sc 阅读全文
posted @ 2013-04-19 20:20 执着追求的IT小小鸟 阅读(237) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1390题目是进制转化的问题,难的在于题目读不懂The positions of 1's in the binary representation of 13 are 0, 2, 3.这句,是说1在13的二进制数中的位置是0.2.3View Code 1 #include<stdio.h> 2 int main() 3 { 4 int n,d,i,j,first; 5 int a[10000]; 6 scanf("%d",&d); 7 while(d--) 8 { 阅读全文
posted @ 2013-04-19 17:37 执着追求的IT小小鸟 阅读(186) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1323同UVA382View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a,i,sum; 5 printf("PERFECTION OUTPUT\n"); 6 while(scanf("%d",&a)&&a) 7 { 8 sum=0; 9 for(i=1;i<=a/2;i++)10 if(a%i==0)11 sum+=i;12 if(sum==a... 阅读全文
posted @ 2013-04-19 16:46 执着追求的IT小小鸟 阅读(137) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1303因为这题的数字和数量都比较小,所以用数组进行逐个标志,先初始化为0,然后将所有输入的数作为下标,对应的数组的值赋为1,最后只需逐个查找原来的数的doubles是否为1,然后逐个相加,就可以知道答案了View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a[101],ans[201]; 5 int i,n,j,sum; 6 while(scanf("%d",&n)&&n!=-1) 7 { 8 for 阅读全文
posted @ 2013-04-19 13:35 执着追求的IT小小鸟 阅读(136) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1212这题类似于UVA上面的you can say 11,用的也是类似那题的割减法View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int b,i,aa[1001],len,ans,d; 6 char a[1001]; 7 while(scanf("%s%d",a,&b)!=EOF) 8 { 9 len=strlen(a);10 for(i=0;a[i]!... 阅读全文
posted @ 2013-04-19 13:08 执着追求的IT小小鸟 阅读(160) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1178这题关键在于推导出通项公式为i*(i+1)/2的前n项和,由于n(n+1)=[n(n+1)(n+2)-(n-1)n(n+1)]/3所以1*2+2*3+...+n(n+1)=[1*2*3-0+2*3*4-1*2*3+....+n(n+1)(n+2)-(n-1)n(n+1)]/3[前后消项]=[n(n+1)(n+2)]/3所以1^2+2^2+3^2+......+n^2=[n(n+1)(n+2)]/3-[n(n+1)]/2=n(n+1)[(n+2)/3-1/2]另外一个就是科学计数法的输出,这里分为两个部分 阅读全文
posted @ 2013-04-18 20:49 执着追求的IT小小鸟 阅读(94) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1397这题跟UVA上面的一题是基本一样的,但是hdoj上的时间限制得更狠,暴力来的话会超时,应该先将2到2的15次的数都打上标识,然后从2开始,循环到输入的那个数n,分别去判断那对数,刚开始是打算一次把所有的数都打表,后来发现时间太特么久了View Code 1 #include<stdio.h> 2 #include<math.h> 3 int yanzheng(int a) 4 { 5 int i; 6 for(i=2;i<=sqrt(a);i++) 7 { 8 if(a%i 阅读全文
posted @ 2013-04-18 20:02 执着追求的IT小小鸟 阅读(146) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1326解法同UVA591,先求平均数,然后再逐个计算,求和View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main()//平均数以下的需要多少,就是最低多少 4 { 5 int n,i,a[100],sum,ave,j,ans; 6 for(i=1;;i++) 7 { 8 ans=0; 9 sum=0;10 scanf("%d",&n);11 if(n==0)12 brea... 阅读全文
posted @ 2013-04-17 22:23 执着追求的IT小小鸟 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页