. Starting from the second line, replace the water on the previous line with the water question, which is listed as follows:
Water
Water questions
Water questions
input multiple sets of data, one line for each group of data.
there are two numbers in each row. For each set of data, find out whether the words in n rows and k columns are "water" or "problem". If it is water, output 0; if it is a question, output 1.
wants to use 0 instead of water and 1 generation instead of water, and report a paragraph error after submission, but it is no problem to compile and run it by itself. I should be a novice. Save the child.
the code is as follows
include < iostream >
using namespace std;
int main () {
int i,j,n,k,a[20][20];
while(cin>>n>>k){
a[0][0]=0;
for(i=1;i<n;iPP){
for(j=0;j<n;jPP){
if(a[i-1][j-1]==0){
a[i][j]=0;
a[i+1][j+1]=1;
}
if(a[i-1][j-1]==1){
a[i][j]=1;
a[i+1][j+1]=0;
}
}
}
cout<<a[n][k]<<endl;
}
return 0;
}