当前位置:网站首页>PAT甲级 1051 Pop Sequence
PAT甲级 1051 Pop Sequence
2022-08-02 23:51:00 【九是否非随机的称呼】
模拟stack
#include<iostream>
#include<vector>
#include<stack>
#include<bits/stdc++.h>
using namespace std;
int main(void){
int i, j, k, m, n, h, mm, nn;
cin>>m>>n>>h;
vector<int> vec[h];
for(i = 0; i < h; i++){
for(j = 0; j < n; j++){
cin>>k;
vec[i].push_back(k);
}
}
for(i = 0; i < h; i++){
stack<int> s;
int cnt = 0;
int num = 1;
while(s.size()<=m){
if(s.size() > 0 && s.top()==vec[i][cnt]){
s.pop();
cnt++;
}
else if(s.size() > 0 && num <=n && s.top()!=vec[i][cnt])
s.push(num++);
else if(s.size()==0 && num <=n)
s.push(num++);
else break;
}
if(s.size() > 0) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}边栏推荐
- vant-swipe adaptive picture height + picture preview
- js基础知识整理之 —— 获取元素和命名规范
- 4、Citrix MCS云桌面无法安装todesk等软件
- 优秀论文以及思路分析01
- random.nextint()详解
- js基础知识整理之 —— 变量和数据类型
- @GetMapping、@PostMapping、@PutMapping、@DeleteMapping的区别
- Understand the next hop address in the network topology in seconds
- 停止使用 Storyboards 和 Interface Builder
- Moco of Mock tools use tutorial
猜你喜欢

Connect the Snowflake of CKAN tutorial CKAN to release to open data portal

Jmeter二次开发实现rsa加密

解决错误:Optional int parameter ‘pageSize‘ is present but cannot be translated into a null value due to

精心整理16条MySQL使用规范,减少80%问题,推荐分享给团队

Day117. Shangyitong: Generate registered order module

稳压电源: 电路图及类型

程序员的七夕浪漫时刻

机电设备制造企业,如何借助ERP系统做好客供料管理?

别再到处乱放配置文件了!我司使用 7 年的这套解决方案,稳的一秕

esp32和ros2基础篇草稿-micro-ros-
随机推荐
如何修复 SAP UI5 aggregation with cardinality 0..1 相关的错误消息
flutter 时间戳转日期
智能合约安全-可重入攻击(SW107-Reentrancy)
matplotlib中的3D绘图警告解决:MatplotlibDeprecationWarning: Axes3D(fig) adding itself to the figure
记一次sql优化Using temporary; Using filesort
十年架构五年生活-04第一个工作转折点
聚乙二醇衍生物4-Arm PEG-DSPE,四臂-聚乙二醇-磷脂
2022 Shandong International Youth Eye Health Industry Exhibition, Vision Health Exhibition, Optometry Exhibition
ORA-55610: Invalid DDL statement on history-tracked table
Last Common Ancestor (LCA) Study Notes | P3379 【Template】Least Common Ancestor (LCA) Problem Solution
js基础知识整理之 —— 全局作用域
Teach you to locate online MySQL slow query problem hand by hand, package teaching package meeting
TensorFlow学习记录(一):基本介绍
谷歌 Chrome 浏览器 104 正式版发布:加快网页加载,蓝牙 API 改进
Wireshark数据抓包分析之传输层协议(TCP协议)
js显示隐藏手机号
UE5 官方案例Lyra 全特性详解 8.如何用配置表初始化角色数据
新公链时代的跨链安全性解决方案
d合并json
2022第十一届财经峰会:优炫软件斩获双项大奖
https://github.com/ZouJiu1/PAT