Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- int main () {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int rows = 40;
- int start = 1;
- vector<int> seat_second;
- for (int row = 1; row <= rows; ++row) {
- //row = 2
- //start = 2
- seat_second.push_back(start);
- seat_second.push_back(start);
- seat_second.push_back(start + 1);
- seat_second.push_back(start + 1);
- seat_second.push_back(start + 2);
- seat_second.push_back(start + 2);
- start += 1;
- }
- sort(seat_second.rbegin(),seat_second.rend());
- //~ for (int i = 0; i < (int) seat_second.size(); ++i) cout << seat_second[i] << ' ';
- int T;
- cin >> T;
- for (int i = 1; i <= T; ++i) {
- int n;
- cin >> n;
- int cost = n * (n - 1) / 2;
- for (int j = 1; j <= n; ++j) {
- cost += seat_second.back();
- seat_second.pop_back();
- }
- cout << cost << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement