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

首頁 > 學院 > 開發(fā)設(shè)計 > 正文

1051. Pop Sequence (25)

2019-11-10 23:54:29
字體:
供稿:網(wǎng)友

題目: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");  }                  


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 崇阳县| 柏乡县| 安达市| 静安区| 陇南市| 乾安县| 阳高县| 渝北区| 平安县| 嫩江县| 赤城县| 武山县| 布拖县| 平陆县| 浠水县| 漾濞| 神木县| 湄潭县| 古丈县| 龙里县| 沂源县| 葵青区| 横山县| 洪泽县| 阿坝县| 河西区| 交城县| 衡山县| 滦平县| 淳化县| 临沧市| 江北区| 浮梁县| 于都县| 卓资县| 茶陵县| 喀喇沁旗| 安溪县| 兴文县| 雷山县| 思茅市|