用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#80211 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 11 ms | 384 K | C++ 17 / 525 B | 规培005 贺晓珉 | 2022-07-16 16:51:51 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
typedef struct {
int a;
int b;
} goods;
goods arr[maxn];
int n, V;
bool cmp(goods x, goods y) { return x.b > y.b; }
int main() {
cin >> V >> n;
for (int i = 0; i < n; i++) cin >> arr[i].a >> arr[i].b;
sort(arr, arr + n, cmp);
ll re = 0;
for (int i = 0; i < n; i++) {
if (V > arr[i].a) {
V -= arr[i].a;
re += (arr[i].a * arr[i].b);
} else if (V <= arr[i].a) {
re += (V * arr[i].b);
cout << re;
return 0;
}
}
cout << re;
return 0;
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
-1157098477
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0