Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int boards_count;
- cin >> boards_count;
- vector<uint64_t> boards_lengths(boards_count);
- for (uint64_t& length : boards_lengths) {
- cin >> length;
- }
- sort(begin(boards_lengths), end(boards_lengths));
- uint64_t result = 0;
- for (uint64_t i = 0; i < boards_lengths.size(); ++i) {
- result = max(result, boards_lengths[i] * (boards_lengths.size() - i));
- }
- cout << result;
- }
- /*
- test1
- 5
- 1 2 3 4 5
- 9
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement