You are viewing a single comment's thread. Return to all comments →
#include <bits/stdc++.h> using namespace std; int r,c,n; int a[201][201]={0}; void solve( string e, string f) { for(int j=0;j<r;j++){ for(int i=0;i<c;i++) { if(a[j][i]==1) cout<<e; else if(a[j][i]>=200) cout<<f; else { if(a[j-1][i]==1||a[j+1][i]==1||a[j][i+1]==1||a[j][i-1]==1) cout<<"."; else cout<<f; } } cout<<endl; } } int main() {//1 . 2 4 O 3 5 LH cin>>r>>c>>n; for(int j=0;j<r;j++){ string str; cin>>str; for(int i=0;i<c;i++) { if(str[i]=='O') {a[j][i]=200; a[j+1][i]+=10; if(j!=0)a[j-1][i]+=10; a[j][i+1]+=10; if(i!=0) a[j][i-1]+=10; } else a[j][i]+=1; } } if(n%2==0) { for(int j=0;j<r;j++) { for(int i=0;i<c;i++) cout<<"O"; cout<<endl; } return 0; } if(n==1) { for(int j=0;j<r;j++) { for(int i=0;i<c;i++) { if(a[j][i]>=200)cout<<"O"; else cout<< "."; } cout<<endl; } return 0; } string e="."; string f="O"; if((n-1)%4==0) solve( e, f); else solve( f, e); /* for(int j=0;j<r;j++) { for(int i=0;i<c;i++) cout<<a[j][i]; cout<<endl; }*/ }
Seems like cookies are disabled on this browser, please enable them to open this website
The Bomberman Game
You are viewing a single comment's thread. Return to all comments →