跳到正文

个人记录

Day3T1代码

RiverBird208约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年4月26日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#define int long long
using namespace std ;
int n , h , maxn , ans ;
signed main()
{
	cin >> n ;
	while(n--)
	{
		cin >> h ;
		if(h > maxn)	maxn = h ;
		else	ans += maxn - h ;
	}
	cout << ans ;
	return 0 ;
}
原文