https://codeforces.me/contest/279/problem/B
may anyone tell me what is the problem with logic
# | User | Rating |
---|---|---|
1 | jiangly | 3976 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3482 |
8 | hos.lyric | 3382 |
9 | gamegame | 3374 |
10 | heuristica | 3357 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | -is-this-fft- | 165 |
3 | Um_nik | 161 |
3 | atcoder_official | 161 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
9 | awoo | 151 |
10 | TheScrasse | 147 |
https://codeforces.me/contest/279/problem/B
may anyone tell me what is the problem with logic
https://codeforces.me/contest/116/problem/B
may anyone please tell me whats wrong with this code not able to input the string array ?
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;
}
Name |
---|