`
阿尔萨斯
  • 浏览: 4179119 次
社区版块
存档分类
最新评论

Codeforces 463B Caisa and Pylons(水题)

 
阅读更多

题目链接:Codeforces 463E Caisa and Pylons

题目大意:给定n个位置的高度,0的位置为0,每次移动一步时,需要消耗hihi+1的能量,一开始能量为0,过程中能量不能为负,一美元可以买一点能量,问说最小开销。

解题思路:水题,找最大值即可。

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int main () {
    int n, x, ans = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x);
        ans = max(ans, x);
    }
    printf("%d\n", ans);
    return 0;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics