Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 600 Accepted Submission(s): 293
2 1 2 2 2 3
2 4
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3420
1 #include<stdio.h> 2 #include<stdlib.h> 3 int cmp(const void* a,const void* b) 4 { 5 return *(int *)a - *(int *)b; 6 } 7 int main() 8 { 9 int n,tmp,sum,i; 10 int num[10000]; 11 while(~scanf("%d",&n)) 12 { 13 for(i=0;i<n;i++) 14 scanf("%d",&num[i]); 15 sum=0; 16 qsort(num,n,sizeof(num[0]),cmp); 17 for(i=0;i<n;i++) 18 { 19 tmp=num[i]*(n-i); 20 if(tmp>sum) 21 sum=tmp; 22 } 23 printf("%d\n",sum); 24 } 25 return 0; 26 }
HDU 3420 -- Bus Fair ACM,布布扣,bubuko.com
原文:http://www.cnblogs.com/yeshadow937/p/3904209.html