摘要: 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小小鸟 阅读(263) 评论(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小小鸟 阅读(156) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2028逐个用辗转相除法算出最小公倍数,直至结束,但是因为中间结果有可能超过32位,所以必须相除后乘,只是这里不懂为什么改了long long还是错掉r=a%b; while(r) { a=b; b=r; r=a%b; }结果b是最大公约数,最小公倍数就是原来ab的积除以bView Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int s[100000]; 4 int pro(int a,int b)... 阅读全文
posted @ 2013-04-06 22:03 执着追求的IT小小鸟 阅读(200) 评论(0) 推荐(0) 编辑