You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
210 B
23 lines
210 B
2 years ago
|
#include<bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
int i,n,num=0;
|
||
|
int s0=0,s1;
|
||
|
cin>>n;
|
||
|
|
||
|
for(i=1;i<=n;i++)
|
||
|
{
|
||
|
cin>>s1;
|
||
|
if(s1>s0)
|
||
|
{
|
||
|
num+=s1-s0;
|
||
|
}
|
||
|
s0=s1;
|
||
|
}
|
||
|
cout<<num;
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|