博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ural_1494. Monobilliards(栈)
阅读量:6907 次
发布时间:2019-06-27

本文共 646 字,大约阅读时间需要 2 分钟。

  题意看了老半天,就是说给一个序列[1, n],看是否是(1, 2, 3, ... n),入栈以后出栈时可以得到的序列。

My Code:

View Code
#include 
#include
using namespace std; const int N = 100007; int st1[N], st2[N]; int main() {
//freopen("data.in", "r", stdin); int i, top1, top2, n; while(cin >> n) {
for(i = 0; i < n; i++) {
cin >> st2[i]; } top1 = 0; top2 = 0; for(i = 1; i <= n; i++) {
st1[++top1] = i; while(top1 != 0 && st1[top1] == st2[top2]) {
--top1; ++top2; } } if(top1) cout << "Cheater"; else cout << "Not a proof"; cout << endl; } return 0; }

转载地址:http://clrdl.baihongyu.com/

你可能感兴趣的文章
Java并发编程笔记—摘抄—基础知识
查看>>
simple-spring-memcached统一缓存的使用实例
查看>>
Codeforces 600E - Lomsat gelral(树上启发式合并)
查看>>
[Hnoi2013]消毒
查看>>
[HNOI2015]开店
查看>>
容斥与反演
查看>>
GitHub 配置指南
查看>>
swift swift学习笔记--函数和闭包
查看>>
Java 面向对象,封装,继承
查看>>
ISO语言代码
查看>>
一文搞懂List 、List<Object>、List<?>的区别以及<? extends T>与<? super T>的区别
查看>>
Java 读写Properties配置文件
查看>>
17.自定义指令
查看>>
使用Maven构建多模块项目
查看>>
Google Shell Style Guide
查看>>
spring和springMVC的上下文
查看>>
create.c
查看>>
2014 蓝桥杯 预赛 c/c++ 本科B组 第九题:地宫取宝(12') [ dp ]
查看>>
手机尾号猜年龄骗局解密
查看>>
并查集加优先队列
查看>>