結果

問題 No.2692 How Many Times Reached?
ユーザー tkykwtnb
提出日時 2024-03-23 07:30:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-30 13:06:28
合計ジャッジ時間 3,070 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=[input() for _ in range(N)]
ans=0
for h in range(N):
    if S[h].count("A")==N-1 and S[h].count(".")==1:ans+=1
for w in range(N):
    cntA=0
    cntD=0
    for h in range(N):
        if S[h][w]=="A":cntA+=1
        elif S[h][w]==".":cntD+=1
    if cntA==N-1 and cntD==1:ans+=1
cntA=0
cntD=0
for h in range(N):
    if S[h][h]=="A":cntA+=1
    elif S[h][h]==".":cntD+=1
if cntA==N-1 and cntD==1:ans+=1
cntA=0
cntD=0
for h in range(N):
    if S[h][N-1-h]=="A":cntA+=1
    elif S[h][N-1-h]==".":cntD+=1
if cntA==N-1 and cntD==1:ans+=1
print(ans)
0