| 比赛 | 专项训练十题 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 积木大赛 | 最终得分 | 100 |
| 用户昵称 | Hyoi_iostream | 运行时间 | 0.033 s |
| 代码语言 | C++ | 内存使用 | 0.31 MiB |
| 提交时间 | 2017-06-02 18:44:15 | ||
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,n;
int ans=0;
int main(){
freopen("BlockNOIP2013.in","r",stdin);
freopen("BlockNOIP2013.out","w",stdout);
scanf("%d",&n);
scanf("%d",&b);
ans+=b;
for(int i=1;i<n;i++){
scanf("%d",&a);
if(a>b) ans+=a-b;
b=a;
}
printf("%d",ans);
fclose(stdin);
fclose(stdout);
return 0;
}