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 <iostream> #include <algorithm> using namespace std; int main() { int arr[10000]; int m;int n; cin>>m; for(int j=0;j<=m-1;++j) {double sum=0; cin>>n; for(int i=0;i<=n-1;++i) { cin>>arr[i]; } sort(arr,arr+n); for(i=0;i<=n-1;++i) { double tem; tem=arr[i]*(n-i); if(tem>sum) sum=tem; } cout<<sum<<endl; }return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator