TOPIC

5% error - C++

vdavid5 asked 3 years ago

include

using namespace std;

int main(){ int X, i, T, L=0; comeco: cin >> X; while(X>0){ int Q[X]; for(i=0;i<X;i++){ cin >> T; if(T==0){ cout << endl; goto comeco; } Q[i]=T; } for(i=0;i<X;i++){ if((Q[i]==Q[i+1]+1) or (Q[i]<Q[i+1]) or ((Q[i]==Q[i-1]+1) and (Q[i]==Q[i+1]+2) and (i>0) )){ L=L+0; }else{ if(i!=X-1){ L=L+1; } } } if(L==0){ cout << "Yes" << endl; }else if(L>=1){ cout << "No" << endl; } L=0; } }

This topic was solved and cannot recieve new replies.