結果
問題 | No.2692 How Many Times Reached? |
ユーザー |
|
提出日時 | 2024-03-23 09:51:28 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,125 bytes |
コンパイル時間 | 4,321 ms |
コンパイル使用メモリ | 262,812 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 13:08:17 |
合計ジャッジ時間 | 5,559 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using ll = long long;using ld = long double;int N, ans;char grid[110][110];int main() {cin >> N;for (int i = 0; i < N; i++) {for (int j = 0; j < N; j++) cin >> grid[i][j];}for (int i = 0; i < N; i++) {int cntA = 0, cntB = 0;for (int j = 0; j < N; j++) {if (grid[i][j] == 'A') cntA++;if (grid[i][j] == 'B') cntB++;}if (cntA == N - 1 && cntB == 0) ans++;}for (int j = 0; j < N; j++) {int cntA = 0, cntB = 0;for (int i = 0; i < N; i++) {if (grid[i][j] == 'A') cntA++;if (grid[i][j] == 'B') cntB++;}if (cntA == N - 1 && cntB == 0) ans++;}int cntA = 0, cntB = 0;for (int i = 0; i < N; i++) {if (grid[i][i] == 'A') cntA++;if (grid[i][i] == 'B') cntB++;}if (cntA == N - 1 && cntB == 0) ans++;cntA = 0, cntB = 0;for (int i = 0; i < N; i++) {if (grid[i][N - 1 - i] == 'A') cntA++;if (grid[i][N - 1 - i] == 'B') cntB++;}if (cntA == N - 1 && cntB == 0) ans++;cout << ans << endl;return 0;}