用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#13623 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 12 ms | 400 K | C++ 17 / 787 B | maki49 | 2019-07-07 11:07:12 |
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2e5 + 5;
struct water {
ll volume;
ll value;
};
water w[maxn];
bool cmp(water A, water B) {
return A.value > B.value; //价值降序
}
int main() {
ll V, n;
cin >> V >> n;
ll ans = 0;
for (int i = 1; i <= n; i++) {
cin >> w[i].volume >> w[i].value;
}
sort(w + 1, w + n + 1, cmp);
while (V) {
for (int i = 1; i <= n; i++) {
if (V > w[i].volume) {
V -= w[i].volume;
ans += w[i].volume * w[i].value;
} else {
ans += V * w[i].value;
V = 0;
}
}
}
cout << ans << endl;
system("pause");
return 0;
}
用户输出
100
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0