CodeChef submission 136794 (C++ 4.3.2) plaintext list. Status: CE, problem SNCK01, contest SNACKDWN. By acecoders (acecoders), 2009-11-21 23:58:00.
#include<iostream.h> #include<conio.h> void main() { clrscr(); unsigned long int m[50][50]; int cl[100],rl[100],k,row,diff; int win=1,flag=0; cin>>k; for(int c=0;c<=k;c++) { cout<<"input limits of array"; cin>>cl[c]>>rl[c]; for(int c1=0;c1<cl[c];c1++) { for(int r1=0;r1<rl[c];r1++) { cin>>m[c1][r1]; } } int flag2; cout<<"start playing the game"<<endl; cout<<"game test case "<<k<<endl; do { for(int j=1;j<=2;j++) { win=j; cout<<"player "<<j<<endl; cout<<"select a row number"<<endl; cin>>row; row=row-1; for(int p=0;p<=cl[k];p++) { flag=0; if(m[row][p]!=0) { flag=1; break; } } if(flag==0) { cout<<"the value is zero"<<endl; } else { cout<<"input the difference"<<endl; cin>>diff; if(diff<=m[row][p]) { m[row][p]-=diff; } else { cout<<"wrong diff"<<endl; break; } } for(int c1=0;c1<cl[c];c1++) { for(int r1=0;r1<rl[c];r1++) { cout<<m[c1][r1]; } } flag2=0; for(int x=0;x<rl[k];x++) { for(int z=0;z<cl[k];z++) { if(m[x][z]!=0) { flag2=1; } } } } } while( flag2==1); if(win==1) { cout<<"first"<<endl; } else cout<<"second"<<endl; } getch(); }
Comments

