提交记录 13947
提交时间 |
评测时间 |
2020-08-13 19:37:49 |
2020-08-13 19:37:53 |
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int n,d[100005],i,qian=0;
long long ans=0;
int main(){
cin>>n;
for(i=1;i<=n;i++){
scanf("%d",&d[i]);
}
for(i=1;i<=n;i++){
if(d[i]<=qian){
qian=d[i];
}
else{
ans+=d[i]-qian;
qian=d[i];
}
}
printf("%lld",ans);
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 37.9 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 46.51 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 45.54 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 40.65 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 40.66 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 45.33 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 65.26 us | 48 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 323.56 us | 84 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 1.507 ms | 240 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 2.903 ms | 428 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:42:18 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠