提交记录 10821
提交时间 |
评测时间 |
2019-10-03 17:57:32 |
2020-08-01 02:31:06 |
#include<bits/stdc++.h>
using namespace std;
template <typename T> void read(T &f)
{
int r=1; char ch=getchar();
while(!isdigit(ch)&&ch!='-') ch=getchar();
if(ch=='-') r=-1; else f=ch-48; ch=getchar();
while(isdigit(ch)) f=f*10+ch-48,ch=getchar();
f*=r; return;
}
int a[100001];
int main()
{
int n=0,ans=0;read(n);
for(int i=1;i<=n;i++) read(a[i]); ans=a[1];
for(int i=2;i<=n;i++)
if(a[i-1]<a[i]) ans+=a[i]-a[i-1];
cout<<ans<<endl;
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 34.17 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 37.01 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 35.14 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 34.28 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 34.49 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 37.08 us | 40 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 46.3 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 154.19 us | 80 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 721.37 us | 236 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 1.404 ms | 428 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:40:31 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠