首页 > 其他 > 详细

BZOJ3850 ZCC Loves Codefires

时间:2015-02-19 17:26:52      阅读:410      评论:0      收藏:0      [点我收藏+]

新年多水水^_^

话说这题逗我。。。国王游戏还不用高精←_←

 

技术分享
 1 /**************************************************************
 2     Problem: 3850
 3     User: rausen
 4     Language: C++
 5     Result: Accepted
 6     Time:56 ms
 7     Memory:1588 kb
 8 ****************************************************************/
 9  
10 #include <cstdio>
11 #include <algorithm>
12  
13 using namespace std;
14 typedef long long ll;
15 const int N = 1e5 + 5;
16  
17 struct data {
18     int x, y;
19      
20     inline bool operator < (const data &a) const {
21         return a.y * x < y * a.x;
22     }
23 } a[N];
24  
25 int n;
26 ll s, ans;
27  
28 int main() {
29     int i;
30     scanf("%d", &n);
31     for (i = 1; i <= n; ++i)
32         scanf("%d", &a[i].x);
33     for (i = 1; i <= n; ++i)
34         scanf("%d", &a[i].y);
35     sort(a + 1, a + n + 1);
36     for (i = 1; i <= n; ++i)
37         s += a[i].x, ans += 1ll * s * a[i].y;
38     printf("%lld\n", ans);
39     return 0;
40 }
View Code

 

BZOJ3850 ZCC Loves Codefires

原文:http://www.cnblogs.com/rausen/p/4296157.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!