| 比赛 | 专项训练十题 | 评测结果 | AAAAAAAAAA |
|---|---|---|---|
| 题目名称 | 积木大赛 | 最终得分 | 100 |
| 用户昵称 | REALIZE_BEYOND | 运行时间 | 0.026 s |
| 代码语言 | C++ | 内存使用 | 0.70 MiB |
| 提交时间 | 2017-05-30 21:01:25 | ||
#include<cstdio>
#include<iostream>
using namespace std;
int a[100005];
int main()
{
freopen("BlockNOIP2013.in","r",stdin);
freopen("BlockNOIP2013.out","w",stdout);
int n,x=0,ans=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]>x)ans+=a[i]-x;
x=a[i];
}
printf("%d",ans);
return 0;
}