https://codeforces.net/contest/279/problem/B
may anyone tell me what is the problem with logic
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
https://codeforces.net/contest/279/problem/B
may anyone tell me what is the problem with logic
https://codeforces.net/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;
}
Название |
---|