提交记录 10619


用户 题目 状态 得分 用时 内存 语言 代码长度
Zhouzj2004 noip18a. 【NOIP2018】铺设道路 Accepted 100 1.267 ms 404 KB C++ 420 B
提交时间 评测时间
2019-09-21 17:00:26 2020-08-01 02:18:19
#include<cstdio>
#define N 100000

using namespace std;

#define max(a, b) ((a) < (b) ? (b) : (a))

void read(int &x)
{
	char ch=getchar(); x=0;
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x << 1) + (x << 3) + (ch ^ 48),ch=getchar();
}

int a[N+1],n,ans=0;

int main()
{
	read(n);
	for (int i=1;i<=n;i++) read(a[i]);
	for (int i=1;i<=n;i++) ans+=max(0,a[i]-a[i-1]);
	printf("%d",ans);
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #16.9 us20 KBAcceptedScore: 10

Testcase #210.65 us20 KBAcceptedScore: 10

Testcase #39.86 us20 KBAcceptedScore: 10

Testcase #47.77 us20 KBAcceptedScore: 10

Testcase #57.59 us20 KBAcceptedScore: 10

Testcase #69.32 us20 KBAcceptedScore: 10

Testcase #717.66 us24 KBAcceptedScore: 10

Testcase #8109.66 us56 KBAcceptedScore: 10

Testcase #9636.97 us212 KBAcceptedScore: 10

Testcase #101.267 ms404 KBAcceptedScore: 10


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