【Codeforces875B】Sorting the Coins
来源:互联网 发布:淘宝代购lv是真的吗 编辑:程序博客网 时间:2024/05/22 07:49
倒着加就好。
#include <bits/stdc++.h>#define gc getchar()#define ll long long#define N 300009using namespace std;int a[N],Ans[N],n;int read(){ int x=1; char ch; while (ch=gc,ch<'0'||ch>'9') if (ch=='-') x=-1; int s=ch-'0'; while (ch=gc,ch>='0'&&ch<='9') s=s*10+ch-'0'; return s*x;}int main(){ n=read(); for (int i=1;i<=n;i++) a[i]=read(); int Max=0,sum=0; for (int i=n;i;i--) { Max=max(Max,a[i]); sum++; Ans[i]=Max-sum; } for (int i=1;i<=n;i++) printf("%d ",Ans[i]+1); puts("1"); return 0;}
阅读全文
0 0
- Codeforces875B-Sorting the Coins
- 【Codeforces875B】Sorting the Coins
- CF D. Sorting the Coins
- CodeForces 876D Sorting the Coins
- Codeforces 876 D. Sorting the Coins 模拟
- Codeforces Round #441 D. Sorting the Coins
- Codeforces 875B Sorting the Coins
- codeforces 876D Sorting the Coins
- Codeforces Round #441 D. Sorting the Coins
- Codeforces 875B Sorting the Coins 题解
- [冒泡 反序表] Codeforces #876D. Sorting the Coins
- Codeforces Round #441 D. Sorting the Coins(线段树)
- #440 Div.2 D.Sorting the Coins 硬币排序问题
- codeforces——875B —— Sorting the Coins
- Codeforces 875B (Round 441 D1) Sorting the Coins
- Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) D. Sorting the Coins 乱搞
- 【反序表+树状数组】Codeforces Round #441(Div.2)D[Sorting the Coins]题解
- Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) D. Sorting the Coins
- 微信支付
- Java应用在Ubuntu平台以服务的方式运行
- java如何保证线程安全
- 爬虫基础-requests库
- 机器学习张志华讲的太太太好了
- 【Codeforces875B】Sorting the Coins
- typescript
- 工业相机50问
- Java
- markdown发生HTML渲染组件出错的解决方案
- [二分+LCA+差分]【NOIP2015D2T3】运输计划 题解
- C语言学习系列1-helloworld示例
- Effect(七)—— BuffEffect
- leetcode算法笔记1