用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20579 | #1077. 1-11B. JM的招摇撞骗 | Wrong Answer | 0 | 22 ms | 356 K | C++ / 618 B | zzzzz | 2019-07-25 13:09:00 |
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
typedef unsigned long long ll;
ll v, n, w;
ll ans = 0;
struct zhu {
ll a;
ll b;
};
bool cmp(zhu m, zhu n) { return (m.b) > (n.b); }
int main() {
cin >> v >> n;
struct zhu z[n];
for (int i = 0; i < n; i++) {
scanf("%llu%llu", &z[i].a, &z[i].b);
}
unsigned long long sum = 0;
// cout<<"hello world";
sort(z, z + n, cmp);
int i = 0;
while (v > 0) {
// cout<<v<<endl;
if (z[i].a <= v) {
sum += z[i].a * z[i].b;
v -= z[i].a;
} else {
sum += v * z[i].b;
}
i++;
if (i >= n) {
break;
}
}
cout << sum << endl;
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
3169309633
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0