Codeforces 463B Caisa and Pylons(水题)

来源:互联网 发布:网络监控系统示意图 编辑:程序博客网 时间:2024/06/03 21:32

题目链接: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;}
0 0
原创粉丝点击