标签:des style http color os strong
Description
Input
Output
Sample Input
5 1 2 3 4 5 5 4 1 2 3 0 6 6 5 4 3 2 1 0 0
Sample Output
Yes No Yes
///简单模拟就AC了,受不了的是还是WA了多次,原来让输出"Yes"我输出了"YES"小错误,大问题。 #include<iostream> #include<string.h> using namespace std; int main() { int a[10000],b[10000],i,j,k,n,m,a1,b1; bool l=1,ll; while(cin>>n&&n) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); ll=1; while(1) { l=1; for(i=0;i<n;i++) { cin>>a[i]; if(a[i]==0) { ll=0;break;} } if(ll==0) break; i=1; b1=0; for(a1=0;a1<n;a1++) { if(b[b1]==a[a1]) b1--; else if(i==a[a1]) i++; else while(a[a1]!=i) { b1++; b[b1]=i; i++; if(i>n) {l=0; break;} } if(i==a[a1]) i++; } if(l==1) cout<<"Yes"<<endl; else cout<<"No"<<endl; } cout<<endl; } return 0; }
标签:des style http color os strong
原文地址:http://blog.csdn.net/rememberautumn/article/details/38011721