上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 27 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2042简单的从后面往前递推View Code 1 #include<stdio.h> 2 int pro(int a) 3 { 4 int l=3,i; 5 for(i=0;i<a;i++) 6 l=(l-1)*2; 7 return l; 8 } 9 int main()10 {11 int n,i,a;12 scanf("%d",&n);13 while(n--)14 {15 scanf("%d",&a);16 printf(&qu 阅读全文
posted @ 2013-04-07 23:45 执着追求的IT小小鸟 阅读(110) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1062在遇到空格或结束之前所有单词连带标点符号一起倒序输出View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 void print(char *s,int *i) 4 { 5 char ss[100000]; 6 int j=0; 7 while((*s)!=' '&&(*s)!='\0') 8 { 9 ss[j++]=*s;10 s++;11 (*i)++;12 }13 while( 阅读全文
posted @ 2013-04-07 23:24 执着追求的IT小小鸟 阅读(285) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1202输入,按题目给的条件计数View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 double pro(double s) 4 { 5 if(s>=90&&s<=100) 6 return 4.0; 7 if(s>=80) 8 return 3.0; 9 if(s>=70)10 return 2.0;11 if(s>=60)12 return 1.0;13 return 0.0; 1.. 阅读全文
posted @ 2013-04-07 23:21 执着追求的IT小小鸟 阅读(192) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1235简单录入,遍历一次,输出结果View Code 1 #include<stdio.h> 2 int main() 3 { 4 int n,i,a[1111],flag,t; 5 while(scanf("%d",&n)&&n) 6 { 7 t=0; 8 for(i=0;i<n;i++) 9 {10 scanf("%d",&a[i]);11 }12 scanf("%d",&flag);13 阅读全文
posted @ 2013-04-07 23:19 执着追求的IT小小鸟 阅读(112) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1157简单求中位数View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int ans[100000]; 4 int cmp(const void *a,const void *b) 5 { 6 return *(int *)a-*(int *)b; 7 } 8 int main() 9 {10 int n,i;11 while(scanf("%d",&n)!=EOF)12 {13 for(i=0;i< 阅读全文
posted @ 2013-04-07 11:12 执着追求的IT小小鸟 阅读(133) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1197简单的进制转化,然后每个位上的数相加,判断如果10,12,16进制的这样的数都相等的话,就输出数字View Code #include <stdio.h>#include<stdlib.h>int main(){ int i, n, sum10, sum12, sum16; for (i=2992; i<10000; i++){ n = i; sum10 = 0; while (n){ sum10 += n%10; ... 阅读全文
posted @ 2013-04-07 11:01 执着追求的IT小小鸟 阅读(110) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1196输入一个十进制数,输出二进制中最后一个不是0的数所代表的数,也就是Lowest Bit利用除k取余的方式,运行到第一1时就可以输出了View Code 1 #include<stdio.h> 2 int pow(int a,int b) 3 { 4 int i,ans=1; 5 for(i=0;i<b;i++) 6 ans*=a; 7 return ans; 8 } 9 int main()10 {11 int t,a,i;12 while(scanf("%d",& 阅读全文
posted @ 2013-04-07 10:49 执着追求的IT小小鸟 阅读(113) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1177用qsort函数对结构体数组进行二级排序,先按题数降序,然后再按做题时间升序。最后在根据someone在整个名单中的排序和获奖名额判断名次五、对结构体二级排序struct Sample{int x;int y;}s[100];//按照x从小到大排序,当x相等时按照y从大到小排序int cmp( const void *a , const void *b ){struct Sample *c = (structSample *)a;struct Sample *d = (structSample *)b; 阅读全文
posted @ 2013-04-07 00:03 执着追求的IT小小鸟 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1236这题在于做题时间的比较,中间要分类去判断出高低,关键在于冒泡排序会超时,要用比较高效的排序,这里用的快排View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 typedef struct 5 { 6 char nam[30]; 7 int score; 8 }stud; 9 10 stud stu[1001];11 12 int cmp(const void * a,c 阅读全文
posted @ 2013-04-06 22:10 执着追求的IT小小鸟 阅读(261) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> int main() { long n,m,i,j,b; long a[100000]; while(scanf("%ld",&n)!=EOF) { a[0]=1; m=1; for(i=1;i<=n;i++) { b=0; for(j=0;j<m;j++) { a[j]=a[j]*i+b; b=a[j]/10000; a[j]=a[j]%10000; ... 阅读全文
posted @ 2013-04-06 22:05 执着追求的IT小小鸟 阅读(154) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 27 下一页