提交记录 13947


用户 题目 状态 得分 用时 内存 语言 代码长度
fangzhijian2020 noip18a. 【NOIP2018】铺设道路 Accepted 100 2.903 ms 428 KB C++ 397 B
提交时间 评测时间
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;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #137.9 us44 KBAcceptedScore: 10

Testcase #246.51 us44 KBAcceptedScore: 10

Testcase #345.54 us44 KBAcceptedScore: 10

Testcase #440.65 us44 KBAcceptedScore: 10

Testcase #540.66 us44 KBAcceptedScore: 10

Testcase #645.33 us44 KBAcceptedScore: 10

Testcase #765.26 us48 KBAcceptedScore: 10

Testcase #8323.56 us84 KBAcceptedScore: 10

Testcase #91.507 ms240 KBAcceptedScore: 10

Testcase #102.903 ms428 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:42:18 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠