摘要: 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) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1407刚开始用暴力,但有优化,结果一直都是TLE,不知道是不是hdoj上面有什么改动没有,后来用了打表的方法,125ms过了View Code 1 #include <stdio.h> 2 #include <math.h> 3 4 int main() 5 { 6 int x, y, z, num, flag; 7 int a[101]; 8 for(x = 1; x < 101; x++) { 9 a[x] = x*x... 阅读全文
posted @ 2013-04-17 22:09 执着追求的IT小小鸟 阅读(157) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1339把2的n次方打表,然后将输入的n依次除以这些数,知道可以整除,输出可以整除的元素的位置的排列,极为p,而n除以这个2^p就是o了逐个查找View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a[100],i,size,n,d,o; 5 a[0]=1; 6 for(i=1;;i++) 7 { 8 if(a[i-1]>1000000) 9 {10 size=i-1;11 ... 阅读全文
posted @ 2013-04-17 21:38 执着追求的IT小小鸟 阅读(155) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1321这题只需反过来输出就可以了,我这里的代码是改自UVA的483View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 void shuchu(char *s,int *i)//当不是空格是倒序输出 5 { 6 char temp[100]; 7 int j=0,k; 8 while((*s)!=32&&(*s)!='\0') 9 {10 temp[ 阅读全文
posted @ 2013-04-17 21:04 执着追求的IT小小鸟 阅读(208) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2114先用打表,可是一直错误,后来发现有个什么数学公式,然后才对了打表View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 __int64 n,sum; 6 int i,a[10001]; 7 a[0]=0; 8 a[1]=1; 9 for(i=2;i<=9999;i++)10 a[i]=((i%10000)*(i%10000)*(i%10000)+a[i-1])%100... 阅读全文
posted @ 2013-04-17 12:48 执着追求的IT小小鸟 阅读(134) 评论(0) 推荐(0) 编辑