用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22474 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 22 ms | 360 K | C++ / 535 B | 文试97-雷广涵 | 2020-02-12 22:18:40 |
#include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 2e5 + 10;
struct water {
int a;
int b;
int v;
bool operator<(const struct water &p) { return b > p.b; }
} t[MAX];
int main() {
int V, n;
cin >> V >> n;
for (int i = 1; i <= n; i++) {
cin >> t[i].a >> t[i].b;
t[i].v = t[i].a * t[i].b;
}
sort(t + 1, t + n + 1);
long long sum = 0, value = 0;
for (int i = 1; i <= n; i++) {
if (sum + t[i].a <= V) {
sum += t[i].a;
value += t[i].v;
} else {
value += (V - sum) * t[i].b;
break;
}
}
cout << value;
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