用户输出
440
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20581 | #1077. 1-11B. JM的招摇撞骗 | Accepted | 100 | 564 ms | 3448 K | C++ / 553 B | zzzzz | 2019-07-25 13:25:55 |
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll v, n;
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) {
if (z[i].a <= v) {
sum += z[i].a * z[i].b;
v -= z[i].a;
} else {
sum += v * z[i].b;
v = 0;
}
i++;
if (i >= n) {
break;
}
}
cout << sum << endl;
}
用户输出
19855
系统信息
Exited with return code 0
用户输出
3137868819
系统信息
Exited with return code 0
54384 185
16682 13
6704 94
47468 31
41638 49
45976 78
50246 98
46821 8
29575 37
32872 59
4
<1703 bytes omitted>
用户输出
5397784
系统信息
Exited with return code 0
48528 220
22435 100
46510 4
38481 76
6885 33
23060 98
203 80
31345 32
3960 45
1993 91
126
<2035 bytes omitted>
用户输出
4852800
系统信息
Exited with return code 0
564806533 32
264919714 249
185025950 644
314145385 923
81359116 817
211013913 150
412944644 59
<384 bytes omitted>
用户输出
535113257084
系统信息
Exited with return code 0
258777268 164
235904101 892
129678858 913
44744214 208
229676221 29
180309315 792
66858600 847
<2292 bytes omitted>
用户输出
257895184811
系统信息
Exited with return code 0
7380479 229
2457156 704
3436581 217
2669603 646
1585198 464
1319096 510
1286616 674
5231346 3
<2820 bytes omitted>
用户输出
7331304028
系统信息
Exited with return code 0
625032840 200000
182015774 849211785
231735416 539710484
14113857 207125115
150955979 14895576
<4105947 bytes omitted>
用户输出
625026050398177219
系统信息
Exited with return code 0
976868782 200000
155725825 876277807
220880850 740342993
58004877 447734571
259037797 899174976
<4132081 bytes omitted>
用户输出
976807927412803834
系统信息
Exited with return code 0
643272824 200000
509 264945726
1134 984771140
2695 7657779
2448 481314356
697 223504587
522 83
<3108454 bytes omitted>
用户输出
160437925781350926
系统信息
Exited with return code 0
793174454 200000
907 522407789
1272 827057483
254 728878902
2922 275992741
2944 317060927
2260
<3122256 bytes omitted>
用户输出
198887223364986092
系统信息
Exited with return code 0
142887686 200000
42 466286527
59 737572099
79 400748408
18 573363331
99 265812241
19 908667805
<2761620 bytes omitted>
用户输出
5036158298336773
系统信息
Exited with return code 0
1000000000 200000
1 325257494
1 395734449
1 441250904
1 653362683
1 119596816
1 989332156
1 8
<2577834 bytes omitted>
用户输出
100200889746027
系统信息
Exited with return code 0
1000000000 200000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 100000000
<2799919 bytes omitted>
用户输出
200000000000000
系统信息
Exited with return code 0
1000000000 200000
828080253 1000000000
261171667 1000000000
525016059 1000000000
726693592 10000
<4377698 bytes omitted>
用户输出
1000000000000000000
系统信息
Exited with return code 0
1000000000 200000
565447885 3
256765929 72
339720868 30
468966832 95
943337839 18
38810059 8
<2761794 bytes omitted>
用户输出
100000000000
系统信息
Exited with return code 0