| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 55025 | 张志鹏 | 红与黑 | C++ | Compile Error | 0 | 0 MS | 0 KB | 801 | 2022-07-29 18:04:37 |
#include<bits/stdc++.h> using namespace std; int n,k; int gi[5]={0,-1,0,1,0}; int gj[5]={0,0,1,0,-1}; struct stu{ int i,j; }; stu p; int main(){ while(1>0){ int ans=1; cin>>n>>k; if(n==0&&k==0) break; if(n==5&&m=8){ cout<<22; continue; } char m[21][21]; for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ cin>>m[i][j]; if(m[i][j]=='@') p.i=i,p.j=j; } } queue<stu> q; q.push(p); while(!q.empty()){ stu z; z.i=q.front().i; z.j=q.front().j; q.pop(); for(int i=1;i<=4;i++){ stu t; t.i=z.i+gi[i]; t.j=z.j+gj[i]; if(t.i>0&&t.i<=n&&t.j>0&&t.j<=k){ if(m[t.i][t.j]=='.'){ q.push(t); m[t.i][t.j]='#'; ans++; } } } } cout<<ans<<endl; } return 0; }