PAT Advanced Level 1051
来源:互联网 发布:京九直通车知乎 编辑:程序博客网 时间:2024/04/30 16:09
题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1051
解题感悟:个人觉得这道题挺有意思的,拙劣代码如下
代码如下:
#include <iostream>#include <cstdio>#include <stack>using namespace std;stack<int> s;int main(){ //freopen("C:\\Users\\Devon\\Desktop\\input.txt","r",stdin); int m,n,k; scanf("%d%d%d",&m,&n,&k); s.push(0); for(int i=0;i<k;i++){ int yes=1; int *isPush=new int[n+1]; for(int i=0;i<=n;i++) isPush[i]=0; while(s.size()>1) s.pop(); for(int j=0;j<n;j++){ int temp; scanf("%d",&temp); if(temp>s.top()&&s.size()>1){ int cur=s.top(); s.pop(); isPush[cur]=1; while(s.size()>1){ int t=s.top(); s.pop(); isPush[t]=1; for(int k=cur+1;k<=t;k++) if(isPush[k]==0) yes=0; cur=t; } } s.push(temp); if(s.size()>m+1) yes=0; } if(!yes) printf("NO\n"); else printf("YES\n"); } return 0;}
0 0
- PAT Advanced Level 1051
- Pat(Advanced Level)Practice--1051(Pop Sequence)
- PAT Advanced Level 1077
- PAT Advanced Level 1078
- PAT Advanced Level 1079
- PAT Advanced Level 1080
- PAT Advanced Level 1010
- PAT Advanced Level 1016
- PAT Advanced Level 1018
- PAT Advanced Level 1039
- PAT Advanced Level 1060
- PAT Advanced Level 1026
- PAT Advanced Level 1029
- PAT Advanced Level 1030
- PAT Advanced Level 1033
- PAT Advanced Level 1034
- PAT Advanced Level 1038
- PAT Advanced Level 1045
- 大写文件夹名和.c和.h文件名
- C# 网页放大缩小(WebBrowser && AxWebBrowser)
- error: The requested URL returned error: 403 while accessing https://jacsice@github.com/jacsice/hous
- 匿名内部类访问外部类中的局部变量必须是final属性
- linux 下安装 openresty-1.7.0.1
- PAT Advanced Level 1051
- Jquery+HTML+CSS运用
- Ehcache详细解读
- PAT Advanced Level 1052
- 你独树一帜,在季节交替
- 的时光三等功时光
- android 反编译和代码解读
- Mybatis的介绍
- QT创建工程时不存在Kits的解决方案