题解:P15638 [ICPC 2022 Tehran R] Final Price

· · 题解

我真求管理员能不能不要再用 与题解区解法大量重复 为理由打回我的题解了/ll

简单题。

每次累加商品的价格变化即可求出第 n 天该商品的最终价格是多少。

::::success[code]

#include <bits/stdc++.h>
#define debug(a) cerr << (#a) << " = " << (a) << endl;
#define int long long
#define maxn 100010
#define endl '\n'
using namespace std;

int n;
void solve() {
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        ans += x;
    }
    cout << ans << endl;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t; t = 1;
//  cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

::::