用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#80595 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 6 ms | 384 K | C++ 17 / 650 B | 15291309895 | 2022-07-18 11:29:39 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
struct water {
int a, b;
} Water[MAXN];
bool compare(water x, water y) { return x.b > y.b; }
int V, n, sum = 0, ans = 0, J;
int main() {
cin >> V >> n;
for (int i = 0; i < n; i++) cin >> Water[i].a >> Water[i].b;
sort(Water, Water + n, compare);
for (int i = 0; i < n; i++)
if (sum + Water[i].a < V) {
sum += Water[i].a;
ans += Water[i].a * Water[i].b;
} else
J = i;
if (sum < V && sum + Water[J].a > V)
ans += 1.0 * (V - sum) * Water[J].b;
cout << ans;
return 0;
}
用户输出
100
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0