Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么通不过严重怀疑~~~~#include<stdio.h> #include<iostream> using namespace std; int a[10001]; int cmp(const void*a,const void*b) { int t=*(int*)a<*(int*)b?1:0; return t; } void main() { int t,n,i,j,s; cin>>t; while(t--) { cin>>n; s=-1; for(i=0;i<n;i++) cin>>a[i]; qsort(a,n,sizeof(int),cmp); for(i=0;i<n;i++) if(s<(i+1)*a[i])s=(i+1)*a[i]; cout<<s<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator