| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 54799 | 桑迪 | 红与黑 | C++ | Wrong Answer | 0 | 0 MS | 256 KB | 505 | 2022-07-29 17:16:09 |
#include<bits/stdc++.h> using namespace std; int w,h,mp[25][25],sx,sy,d[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; char t; int dfs(int x,int y){ for(int i=0;i<4;i++){ int tx=x+d[i][0],ty=d[i][1]; if(tx<=w&&ty<=h&&tx>0&&ty>0&&mp[tx][ty]==0){ mp[tx][ty]=1; dfs(tx,ty); } } } int main(){ cin>>w>>h; while(w+h){ for(int i=1;i<=w;i++)for(int j=1;j<=h;j++){ cin>>t; if(t=='#')mp[i][j]=1; if(t=='@')sx=i,sy=j; } cout<<dfs(sx,sy)<<endl; cin>>w>>h; } return 0; }