Skip to content

Commit b2f81d9

Browse files
committed
atcoder/abc050B
1 parent 4454560 commit b2f81d9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

atcoder/abc050/B/main.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int main() {
8+
ios_base::sync_with_stdio(false);
9+
cin.tie(0); cout.tie(0);
10+
11+
int N, M;
12+
vector<int> T;
13+
14+
cin >> N;
15+
T.assign(N, 0);
16+
for (auto &t : T) cin >> t;
17+
cin >> M;
18+
for (int i = 0; i < M; ++i) {
19+
int p, x;
20+
cin >> p >> x;
21+
--p;
22+
23+
int ans = 0;
24+
for (int j = 0; j < N; ++j) {
25+
if (j == p) ans += x;
26+
else ans += T[j];
27+
}
28+
cout << ans << endl;
29+
}
30+
31+
return 0;
32+
}

0 commit comments

Comments
 (0)