【题目链接】:http://codeforces.com/contest/767/problem/A

【题意】



每天掉一个盘子下来;盘子有大小从1..n依次增大n个盘子;

然后让你叠盘子;

最底层为n,倒数第二层为n-1….最上层为1;

让你输出每天叠了哪些盘子;

【题解】



因为是要连续叠在一起的;

所以每一天其实都有一个固定要等待的盘子;

如果等到了那个盘子;

就一直往下走;输出连续的盘子;

没有的话,它就是下一个需要等待的盘子了;



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x)
#define ref(x) scanf("%lf",&x) typedef pair<int, int> pii;
typedef pair<LL, LL> pll; const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };
const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };
const double pi = acos(-1.0);
const int N = 1e5+100; int n;
int wait;
int chuxian[N]; int main()
{
//freopen("D:\\rush.txt", "r", stdin);
rei(n);
wait = n;
rep1(i,1,n)
{
int x;
rei(x);
chuxian[x] = 1;
while (chuxian[wait])
{
printf("%d ",wait);
wait--;
}
puts("");
}
//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}

【codeforces 767A】Snacktower的更多相关文章

  1. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  2. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  3. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  4. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

  5. 【codeforces 709B】Checkpoints

    [题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...

  6. 【codeforces 709C】Letters Cyclic Shift

    [题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...

  7. 【Codeforces 429D】 Tricky Function

    [题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...

  8. 【Codeforces 670C】 Cinema

    [题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...

  9. 【codeforces 515D】Drazil and Tiles

    [题目链接]:http://codeforces.com/contest/515/problem/D [题意] 给你一个n*m的格子; 然后让你用1*2的长方形去填格子的空缺; 如果有填满的方案且方案 ...

随机推荐

  1. 使用自定义的AlertDialog。

    使用自定义的AlertDialog.1.核心的方法是setView(View view):把自己的view放置到dialog中填充.2.setCanceledOnTouchOutside(boolea ...

  2. JSP-Runoob:JSP 生命周期

    ylbtech-JSP-Runoob:JSP 生命周期 1.返回顶部 1. JSP 生命周期 理解JSP底层功能的关键就是去理解它们所遵守的生命周期. JSP生命周期就是从创建到销毁的整个过程,类似于 ...

  3. poj1006生理周期(中国剩余定理)

    生理周期 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 139224   Accepted: 44687 Descripti ...

  4. [Swift通天遁地]二、表格表单-(6)创建美观的表格弹性下拉刷新效果

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  5. poi导出excel改变标题颜色

    在excelutil类里面添加 public class ExcelUtil { public static Workbook fillExcelData(ResultSet rs, Workbook ...

  6. c++小游戏

    #include <iostream> using namespace std; double shengmingli=2000;//定义主角初始生命力 int gongjili=150; ...

  7. 329 Longest Increasing Path in a Matrix 矩阵中的最长递增路径

    Given an integer matrix, find the length of the longest increasing path.From each cell, you can eith ...

  8. MVC系列学习(十一)-客户端的验证

    1.通过一个实例,来了解MVC中强大的验证功能 1.1新建一个 [基本] 的mvc项目,因为要用到验证的js,然后在一个视图中写上一下代码,以及Model中的代码如下 [注]在调用html.EditF ...

  9. NetBeans将java项目编译成jar包

    1.找到file选项下的build.xml.

  10. 【技术累积】【点】【java】【27】@JSONField

    @JSONField 该注解隶属于阿里fastjson,方便fastjson处理对象时的一些操作 源码 @Retention(RetentionPolicy.RUNTIME) @Target({ El ...