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

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

1051. Pop Sequence (25)

2019-11-11 00:13:47
字體:
供稿:網(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ā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 百色市| 磐石市| 洪雅县| 乾安县| 高青县| 长武县| 法库县| 蓝田县| 拜城县| 苗栗市| 梓潼县| 巴中市| 永兴县| 舞钢市| 三亚市| 临朐县| 锦州市| 镇巴县| 灌阳县| 修水县| 盐池县| 宣威市| 平陆县| 义马市| 磴口县| 钦州市| 赫章县| 榆社县| 海安县| 武汉市| 北海市| 尉氏县| 山阳县| 会宁县| 油尖旺区| 平乡县| 永仁县| 黄浦区| 卓尼县| 东兴市| 启东市|