用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20887 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 33 ms | 396 K | C++ / 664 B | kong | 2019-08-15 16:04:36 |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> prdd;
vector<prdd> water;
ll v, n, sum = 0;
bool cmp(prdd w1, prdd w2) { return w1.second > w2.second; }
int main() {
scanf("%lld%lld", &v, &n);
int x, y;
while (n--) {
scanf("%d%d", &x, &y);
water.push_back(make_pair(x, y));
}
sort(water.begin(), water.end(), cmp);
for (int i = 0; i < water.size(); i++) {
if (v < 0)
break;
if (v < water[i].first) {
sum += v * water[i].second;
break;
}
v = v - water[i].first;
sum += water[i].first * water[i].second;
}
cout << sum;
return 0;
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
3137868819
系统信息
Exited with return code 0
54384 185
16682 13
6704 94
47468 31
41638 49
45976 78
50246 98
46821 8
29575 37
32872 59
4
<1703 bytes omitted>
用户输出
5397784
系统信息
Exited with return code 0
48528 220
22435 100
46510 4
38481 76
6885 33
23060 98
203 80
31345 32
3960 45
1993 91
126
<2035 bytes omitted>
用户输出
4852800
系统信息
Exited with return code 0
564806533 32
264919714 249
185025950 644
314145385 923
81359116 817
211013913 150
412944644 59
<384 bytes omitted>
用户输出
11127246972
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0