【题目链接】: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. touch事件的分发机制

    作者:谢昆 一段伪代码反应整个touch事件的分发 public boolean dispatchTouchEvent(MotionEvent event) { boolean consume = f ...

  2. bzoj3771

    http://www.lydsy.com/JudgeOnline/problem.php?id=3771 生成函数... 其实就是多项式乘法...lrj书上有一个通俗的解释... 然后就是这个样子,我 ...

  3. ural 1009. K-based Numbers(简单dp)

    http://acm.timus.ru/problem.aspx?space=1&num=1009 题意:将一个n位数转化为合法的K进制数,有多少种情况.合法的K进制数即不含前导0,且任意两个 ...

  4. B. Mashmokh and ACM(dp)

    http://codeforces.com/problemset/problem/414/B B. Mashmokh and ACM time limit per test 1 second memo ...

  5. codevs1258 关路灯(☆区间dp)

    1258 关路灯  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 大师 Master     题目描述 Description 多瑞卡得到了一份有趣而高薪的工作.每天早晨他必须 ...

  6. asp.net MVC 给Controler传一个JSon集合,后台通过List<Model>接收

    需求情景 View层经常需要通过Ajax像后台发送一个json对象的集合,但是在后台通过List<Model>无法接收,最后只能通过妥协的方式,在后台获取一个json的字符串,然后通过Js ...

  7. Google广告屏蔽插件adBlock

    今天在博客园写博客的时候发现莫名其妙的在右侧被植入了广告,询问了管理员得知存在以下几种可能: 1.电信网络供应商劫持网页,植入广告 2.ADSafe(是一款去除广告的软件,效果很不错) 但经过最终排除 ...

  8. conda python虚拟环境

    #查看已安装的python包 conda list #查看当前有哪些虚拟环境 conda env list 或者 conda info -e #更新conda conda update conda # ...

  9. java练习题-求int类型N值的阶乘

    //求int类型N值的阶乘 public static int getNumsJieCheng(int i){ int rs = 1; if(i==0||i==1){ return i; } if(i ...

  10. js面试笔试题

    1. Js的Typeof返回类型有那些? string:undefined:number; function:object:boolean:symbol(ES6) 2. null和undefined的 ...