ural1494 Monobilliards】的更多相关文章

Monobilliards Time limit: 1.0 secondMemory limit: 64 MB A monobilliards table set up in a gaming house of a town N turned out to be a very profitable investment, but only till the day the famous Mr. Chichikov came to the town. Chichikov was winning a…
1494 之前记得数据结构试卷上有这种题 就是判断某一出栈顺序 是不是满足以1.2...n为入栈顺序 a1,a2,a3..an; 对于任意相邻a[i],a[i+1] 如果a[i]>a[i+1]+1 那么它两之间的数肯定已经在前面出栈过了 不然中间的不出栈 a[i+1]不可能出来 这一个条件就可以判断了 用数状数组求下和 就行了 #include <iostream> #include<cstdio> #include<cstring> #include<al…
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; ],b[]; int main() { int n; while(scanf("%d",&n)!=EOF) { ; i<=n; i++) scanf("%d",a+i); ,top1=; ; i<=n; i++) { b[++top]=i; while(t…