标签:des style blog http color os io java ar
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 790 Accepted Submission(s): 420
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 struct node{ 6 int e,t; 7 bool operator < (const node a) const{ 8 return e*a.t>a.e*t; 9 } 10 }map[100005]; 11 int main(){ 12 int n,i; 13 __int64 tat,ans; 14 while(scanf("%d",&n)!=EOF){ 15 for(i=0;i<n;i++) 16 scanf("%d",&map[i].t); 17 for(i=0;i<n;i++) 18 scanf("%d",&map[i].e); 19 sort(map,map+n); 20 for(ans=tat=i=0;i<n;i++){ 21 tat+=map[i].t; 22 ans+=tat*map[i].e; 23 } 24 printf("%I64d\n",ans); 25 } 26 return 0; 27 }
2014---多校训练2(ZCC Loves Codefires)
标签:des style blog http color os io java ar
原文地址:http://www.cnblogs.com/gongxijun/p/3958447.html