Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: iAOMNC

Problemset: หุ่นพัง

Language: cpp

Time: 0.003 second

Submitted On: 2025-11-11 11:20:24

#include<bits/stdc++.h>
using namespace std;
char b[30][30];
void sch(int x,int y)
{
if(b[x-1][y]=='.'&& x!=0)
{
b[x][y] ='0';
sch(x-1,y);
}
if(b[x][y-1]=='.' && y!=0)
{
b[x][y]='0';
sch(x,y-1);
}
b[x][y]='0';
return;
}

int main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    int a;
    cin >> a;
    for(int i=0; i< a;i++)
    {
    for(int j=0; j< a;j++)
    {
   cin>>  b[j][i];
    }
    }
    sch(a-1,a-1);
    int ans=0;
    for(int i=0; i< a;i++)
    {
    for(int j=0; j< a;j++)
    {
    if(b[j][i]=='0')
    {
    ans++;
    }
    }
    
    }
    cout << ans;
}