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 |
Re:有什么注意点,wa了两把了In Reply To:有什么注意点,wa了两把了 Posted by:skogt at 2010-08-20 10:24:57 > 有什么注意点,wa了两把了 #include<iostream> #include<algorithm> using namespace std; struct In { int x; int y; }arr[50001]; int ans[50001]; int main() { int n; while(scanf("%d",&n) && n!=-1) { int minh=9999999; int totalw=0; for(int i=0;i<n;i++){ scanf("%d %d",&arr[i].x,&arr[i].y); if(arr[i].y<minh) minh=arr[i].y; totalw+=arr[i].x; ans[i]=arr[i].x*arr[i].y; } sort(ans,ans+n); int s; s=totalw*minh; printf("%d\n",s>ans[n-1] ? s : ans[n-1]); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator