mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
P2637 第一次,第二次,成交!
R52203856
This commit is contained in:
parent
e9d383c241
commit
a42a218177
21
Luogu/problem/P2637/P2637.cpp
Normal file
21
Luogu/problem/P2637/P2637.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, m, a[1005], ans = 0, sum = 0;
|
||||
cin >> n >> m;
|
||||
for (int i = 0; i < m; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
sort(a, a + m);
|
||||
for (int i = 0; i < m; i++) {
|
||||
int now = a[i];
|
||||
if (now * (m - i) > ans && m - i <= n) {
|
||||
sum = now;
|
||||
ans = now * (m - i);
|
||||
}
|
||||
}
|
||||
cout << sum << ' ' << ans;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user