用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22473 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 16 ms | 364 K | C++ / 529 B | 文试97-雷广涵 | 2020-02-12 22:18:04 |
#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);
int 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
用户输出
-1157098477
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0