#include using namespace std; char grass[22][22]; int terrainCounter[22][22]; int wolves[22][22]; int sheeps[22][22]; int sheepsFuture[22][22]; int wolvesFuture[22][22]; int t,rows,columns; int main() { cin>>t>>rows>>columns; for(int i=0;i>s; for(int j=0;j 0){ int tmp = wolves[i][j]; wolves[i][j] = 0; if(j+1 == columns){ wolvesFuture[i][0] = tmp-1; } else{ wolvesFuture[i][j+1] = tmp-1; } } } } //sheep move for(int i=0;i 0){ int tmp = sheeps[i][j]; sheeps[i][j] = 0; if(i+1 == rows){ sheepsFuture[0][j] = tmp-1; } else{ sheepsFuture[i+1][j] = tmp-1; } } } } // if sheep is on the same tile as a wolf for(int i=0;i 0 && wolvesFuture[i][j] > 0){ grass[i][j] = '*'; terrainCounter[i][j] = 0; sheepsFuture[i][j] = 0; wolvesFuture[i][j] = 11; } } } // sheep eats for(int i=0;i 0 && grass[i][j] == '#'){ sheepsFuture[i][j] = 6; grass[i][j] = '.'; terrainCounter[i][j] = -1; } } } // wolf starves for(int i=0;i 0){ cout << "W"; } else if (sheeps[i][j] > 0){ cout << "S"; } else{ cout << grass[i][j]; } } cout << endl; } // std::cout << "Hello, World!" << std::endl; return 0; }