|
|
back to boardWa #7 Can somebody gives me some tests Re: Wa #7 Help please! Here is my code #include <iostream> using namespace std; long a[100000]; long b[100000]; long c[100000]; int main() { long n,k=1,s,s1,l;
cin>>n; if(n==2) { cout<<"Not a proof"; goto tu; } for(int i=n;i>0;i--) { cin>>a[i]; }
while(a[k]<a[k+1]) { b[k]=a[k]; l=k; k++; } if(n-k==0) { cout<<"Not a proof"; goto tu; }
for(int i=k;i<=n;i++) { c[i]=a[i]; } n-=k; for(int i=k;i<=n;i++) { if(c[i]>=c[i+1]) { cout<<"Cheater"; goto tu; }} cout<<"Not a proof"; tu: ; system("pause"); return 0; } Edited by author 05.05.2008 02:57 Re: Wa #7 And this my other solution #include <iostream> using namespace std; long a[1000000]; long u[1000000]; int main() { long n,b=0; cin>>n; int s=0,br=0,s1=0,x=1;
for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=n;i>0;i--) { b=a[i]; u[x]=b; x++; } for(int i=1;i<=n;i++) { s1=u[i+1]-u[i]; if((u[i]<u[i+1]) && (s1>1))br++; } for(int i=1;i<=n;i++) {s=u[i+1]-u[i]; if(s>1) { if(s==a[br]) br--; else {cout<<"Cheater"; goto tu; } if(s<0 && br==0) {cout<<"Cheater"; goto tu; } } } cout<<"Not a proof";
tu :; system("pause"); return 0; } Edited by author 05.05.2008 03:00 |
|
|