1 条题解
-
0
A35 贪心算法 P1969 [NOIP2013 提高组] 积木大赛
#include <bits/stdc++.h> using namespace std; int n, a, last = 0, ans = 0; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (a > last) ans += (a - last); last = a; } cout << ans << endl; return 0; }
- 1
信息
- ID
- 53
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 202
- 已通过
- 44
- 上传者