We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4454560 commit b2f81d9Copy full SHA for b2f81d9
atcoder/abc050/B/main.cpp
@@ -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