洛谷 1969 积木大赛——水题
生活随笔
收集整理的這篇文章主要介紹了
洛谷 1969 积木大赛——水题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目:https://www.luogu.org/problemnew/show/P1969
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,a,b,ans; int main() {scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&a);ans+=max(0,a-b);b=a;}printf("%d\n",ans);return 0; }?
轉載于:https://www.cnblogs.com/Narh/p/9648001.html
總結
以上是生活随笔為你收集整理的洛谷 1969 积木大赛——水题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 函数、装饰器、迭代器、内置方法总练习题
- 下一篇: 《2018面向对象程序设计(java)课