国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

1051. Pop Sequence (25)

2019-11-11 00:51:54
字體:
來源:轉載
供稿:網友

題目:https://www.patest.cn/contests/pat-a-PRactise/1051

代碼:

#include<cstdio>  #include<cstring>  #include<cstdlib> #include<cmath>#include<stack>#include<string>#include<iostream>#include<algorithm>  using namespace std; int main()  {   	stack<int> s;	int m,n,k;	int a[1010];	scanf("%d%d%d",&m,&n,&k);	while(k--){		bool flag=true;		int temp=1;		while(!s.empty()){			s.pop();		}		for(int i=1;i<=n;i++){		  scanf("%d",&a[i]);		}		for(int i=1;i<=n;i++){			s.push(i);			if(s.size()>m){			  flag=false;			  break;			}			while(!s.empty()&&s.top() == a[temp]){				s.pop();				temp++;			}		}		if(s.empty() == true && flag == true){		   printf("YES/n");		}else{		  printf("NO/n");		}	 }    system("pause");  }                  


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五峰| 凤台县| 新郑市| 射洪县| 阿拉善盟| 乌恰县| 新沂市| 无棣县| 怀化市| 巴青县| 台前县| 磴口县| 辽阳县| 灵台县| 玉龙| 兴安县| 银川市| 南通市| 阿荣旗| 资阳市| 淄博市| 禄劝| 荥经县| 武宣县| 广元市| 渑池县| 连城县| 诸暨市| 棋牌| 阆中市| 宁蒗| 荆州市| 闽清县| 长治市| 钟山县| 高阳县| 开平市| 郑州市| 增城市| 吴川市| 建瓯市|