用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#13435 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 23 ms | 344 K | C++ / 484 B | 电类816 叶雨轩 | 2019-07-06 21:52:32 |
#include <iostream>
#include <algorithm>
using namespace std;
struct node {
long long w, v;
} a[200005];
int cmp(node x, node y) { return x.v > x.v; }
unsigned long long ans;
int main() {
int l, n;
cin >> l >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i].w >> a[i].v;
}
sort(a + 1, a + 1 + n, cmp);
for (int i = 1; i <= n; i++) {
if (l >= a[i].w) {
ans += a[i].w * a[i].v;
l -= a[i].w;
} else {
cout << ans + a[i].v * l;
return 0;
}
}
cout << ans;
return 0;
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
3134170936
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0