题意不复述。

用个bool数组记录一下,如果某一天,当前剩下的最大的出现了的话,就输出一段。

#include<cstdio>
using namespace std;
int n;
bool vis[100010];
int main()
{
// freopen("a.in","r",stdin);
scanf("%d",&n);
int x;
int now=n;
for(int i=1;i<=n;++i)
{
scanf("%d",&x);
vis[x]=1;
if(vis[now])
{
printf("%d",now);
--now;
while(vis[now])
{
printf(" %d",now);
--now;
}
}
puts("");
} return 0;
}

【暴力】Codeforces Round #398 (Div. 2) A. Snacktower的更多相关文章

  1. Codeforces Round #398 (Div. 2) A. Snacktower 模拟

    A. Snacktower 题目连接: http://codeforces.com/contest/767/problem/A Description According to an old lege ...

  2. Codeforces Round #398 (Div. 2)

    Codeforces Round #398 (Div. 2) A.Snacktower 模拟 我和官方题解的命名神相似...$has$ #include <iostream> #inclu ...

  3. 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog

    题目传送门 /* 数论/暴力:找出第一次到a1,a2的次数,再找到完整周期p1,p2,然后以2*m为范围 t1,t2为各自起点开始“赛跑”,谁落后谁加一个周期,等到t1 == t2结束 详细解释:ht ...

  4. 暴力 Codeforces Round #305 (Div. 2) B. Mike and Fun

    题目传送门 /* 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) */ #include <cstdio> #include <cstring> #includ ...

  5. 暴力 Codeforces Round #183 (Div. 2) A. Pythagorean Theorem II

    题目传送门 /* 暴力:O (n^2) */ #include <cstdio> #include <algorithm> #include <cstring> # ...

  6. 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight

    题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...

  7. 二分查找/暴力 Codeforces Round #166 (Div. 2) B. Prime Matrix

    题目传送门 /* 二分查找/暴力:先埃氏筛选预处理,然后暴力对于每一行每一列的不是素数的二分查找最近的素数,更新最小值 */ #include <cstdio> #include < ...

  8. 构造+暴力 Codeforces Round #283 (Div. 2) B. Secret Combination

    题目传送门 /* 构造+暴力:按照题目意思,只要10次加1就变回原来的数字,暴力枚举所有数字,string大法好! */ /************************************** ...

  9. Codeforces Round #398 (div.2)简要题解

    这场cf时间特别好,周六下午,于是就打了打(谁叫我永远1800上不去div1) 比以前div2的题目更均衡了,没有太简单和太难的...好像B题难度高了很多,然后卡了很多人. 然后我最后做了四题,E题感 ...

随机推荐

  1. CentOS系统缺少库文件解决办法

    By francis_hao    May 31,2017   程序在编译时出现缺少库文件的提示,如下: as: error while loading shared libraries: libz. ...

  2. Codeforces 931.D Peculiar apple-tree

    D. Peculiar apple-tree time limit per test 1 second memory limit per test 256 megabytes input standa ...

  3. css的padding,border,margin的意思

    下面的内边距(padding).边框(border) .外边距(margin)的意思是我自己的理解. 代码如下: <!DOCTYPE html> <html lang="e ...

  4. bzoj 4237 稻草人 CDQ

    稻草人 Time Limit: 40 Sec  Memory Limit: 256 MBSubmit: 1433  Solved: 626[Submit][Status][Discuss] Descr ...

  5. LwIP - raw/callback API、协议栈API(sequential API)、BSD API(或者说 SOCKET API)

    1.使用raw/callback API编程,用户编程的方法是向内核注册各种自定义的回调函数,回调函数是与内核实现交换的唯一方式. recv_udp, accept_function, sent_tc ...

  6. 【转载】How long is “too long” for MySQL Connections to sleep?

    From:http://dba.stackexchange.com/questions/1558/how-long-is-too-long-for-mysql-connections-to-sleep ...

  7. JavaScript创建对象时常用的设计模式

    转自:http://www.cnblogs.com/shouce/p/5488101.html 一.工厂模式 function person (name,age) { var p=new Object ...

  8. commons

    <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang --> <dependency> <g ...

  9. 转:A Painless Q-learning Tutorial (一个 Q-learning 算法的简明教程)

    demo 参见 MDP DEMO   本文是对 http://mnemstudio.org/path-finding-q-learning-tutorial.htm 的翻译,共分两部分,第一部分为中文 ...

  10. 好几次的CSS存档

    第一次: #site_nav_under { display: none; } .c_ad_block, .ad_text_commentbox { display: none; margin:; p ...