跳到正文

题解

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

Ethan_sun约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年3月7日
收录
2026年3月12日
更新
2026年11月3日
篇幅
约 1 分钟
题目
P15638

版本

  1. v1当前

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

简单题。

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

code
C++
#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;
}
原文