摘要:
View Code #include<stdio.h>#include<math.h>int wanshu(int a){ int i,sum=1; for(i=2;i<=a/2;i++) if(a%i==0) sum+=i; return sum==a;}int main(){ int a,b,n,sum,temp; scanf("%d",&n); while(n--) { sum=0; scanf("%d%d",&a,&b); if(b<a) { temp=a; a=b; b=temp; } 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1173求出x,y的中位数,即为答案,代码中运用快排View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 double x[1000000],y[1000000]; 4 int cmp(const void*a,const void*b) 5 { 6 return *(double *)a>*(double *)b?1:-1; 7 }//快排 8 int main() 9 {10 int n,i;11 while(scanf(&q 阅读全文