Problem help

Правка en1, от _used, 2020-07-05 13:30:23

https://codeforces.net/contest/116/problem/B

may anyone please tell me whats wrong with this code not able to input the string array ?

include <bits/stdc++.h>

define rep(i, n) for (int i = 0; i < (n); i++)

define MAX 10000

using namespace std; typedef long long ll;

int main() { int n, m; string c[12][13]; cin>>n>>m;

for (int i = 1; i <= n; ++i)
{
     cin>>c[i][1];
}

/* 
 skip 
cout<<"the displayed  value"<<endl;

for(int i=1;i<=n;i++)
    cout<<c[i][1]<<endl;

  */

int eaten = 0;

for (int i = 1; i <= n; ++i)
{
    for (int j = 1; j <= m; ++j)
    {
        if (c[i][j] == "W")
        {
            if (c[i-1][j] == "P" || c[i+1][j] == "P" || c[i][j-1] == "P" || c[i][j+1] == "P")
            {
                eaten += 1;
            }
        }
    }
}

 cout<<eaten<<endl;


return 0;

}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский _used 2020-07-05 13:30:23 996 Initial revision (published)