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 |
大侠帮一下啊.WA为什么啊?#include <iostream> using namespace std; int main() { int n,m,i,temp,j,weight; cin>>n; while(n-->0) { cin>>m; weight = 0; int *W = new int[m]; for(i=0;i<m;i++) cin>>W[i]; for(i=0;i<m-1;i++) for( j=1;j<m;j++) if(W[j]>W[i]) { temp = W[j]; W[j] = W[i]; W[i] = temp; } for(j=m*W[0];;j--) { for(i=0;i<m;i++) { if(double(j)/double(m-i) > W[m-i-1]) continue; else { weight = 1; cout<<j<<endl; break; } } if(weight) break; } delete[]W; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator