結果
問題 | No.2692 How Many Times Reached? |
ユーザー |
![]() |
提出日時 | 2024-03-22 21:36:34 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,095 bytes |
コンパイル時間 | 1,955 ms |
コンパイル使用メモリ | 204,496 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 11:03:22 |
合計ジャッジ時間 | 3,077 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h>#ifdef LOCAL#include "./debug.cpp"#else#define debug(...)#define print_line#endifusing 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;}