結果
| 問題 | No.2692 How Many Times Reached? | 
| コンテスト | |
| ユーザー |  Today03 | 
| 提出日時 | 2024-03-22 21:36:34 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 1,095 bytes | 
| コンパイル時間 | 2,284 ms | 
| コンパイル使用メモリ | 194,632 KB | 
| 最終ジャッジ日時 | 2025-02-20 11:20:39 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 43 | 
ソースコード
#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int cnt = 0, cnt2 = 0;
        for (int j = 0; j < N; j++) {
            cnt += S[i][j] == 'A';
            cnt2 += S[i][j] == '.';
        }
        ans += cnt == N - 1 && cnt2 == 1;
        cnt = 0, cnt2 = 0;
        for (int j = 0; j < N; j++) {
            cnt += S[j][i] == 'A';
            cnt2 += S[j][i] == '.';
        }
        ans += cnt == N - 1 && cnt2 == 1;
    }
    int cnt = 0, cnt2 = 0;
    for (int i = 0; i < N; i++) {
        cnt += S[i][i] == 'A';
        cnt2 += S[i][i] == '.';
    }
    ans += cnt == N - 1 && cnt2 == 1;
    cnt = 0, cnt2 = 0;
    for (int i = 0; i < N; i++) {
        cnt += S[i][N - i - 1] == 'A';
        cnt2 += S[i][N - i - 1] == '.';
    }
    ans += cnt == N - 1 && cnt2 == 1;
    cout << ans << endl;
}
            
            
            
        