社区讨论
help
P1318积水面积参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @lo1av0md
- 此快照首次捕获于
- 2023/10/22 18:02 2 年前
- 此快照最后确认于
- 2023/11/02 18:20 2 年前
CPP
#include <iostream>
using namespace std;
int a[10010];
int main()
{
int n, mx = 0, cnt = 0;
cin >> n;
for (int i = 1; i <= n - 1; i++)
{
cin >> a[i];
}
for (int i = 2; i < n; i++)
{
bool f = true;
for (int j = i + 1; j < n; j++)
{
if (a[j] < a[j - 1])
{
cout << cnt;
return 0;
}
}
if (a[i] > mx) mx = a[i];
cnt += mx - a[i];
}
cout << cnt;
return 0;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...