Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- #include <algorithm>
- using namespace std;
- typedef long long ll;
- int main()
- {
- int n;
- cin >> n;
- ll add = 0, subtract = 0;
- for(int i = 1; i <= n; i++) {
- int x;
- cin >> x;
- int rounds = n;
- while(rounds > 1) {
- if(i <= rounds / 2) {
- add += x;
- }
- else if(i > rounds / 2 and i <= rounds) {
- subtract += x;
- }
- rounds /= 2;
- }
- }
- cout << add - subtract << endl;
- return 0;
- }
- // 2222222222
- // 22222222222
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement