码迷,mamicode.com
首页 > 其他好文 > 详细

BZOJ3850 ZCC Loves Codefires

时间:2015-02-19 17:28:59      阅读:229      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!