結果

問題 No.2692 How Many Times Reached?
ユーザー hiro1729hiro1729
提出日時 2024-03-22 21:23:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 60,288 KB
最終ジャッジ日時 2024-09-30 10:46:19
合計ジャッジ時間 3,180 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = [input() for _ in range(N)]
ans = 0
for i in range(N):
	if S[i].count('A') == N - 1 and S[i].count('.') == 1:
		ans += 1
for i in range(N):
	ca = 0
	cd = 0
	for j in range(N):
		if S[j][i] == 'A':
			ca += 1
		if S[j][i] == '.':
			cd += 1
	if ca == N - 1 and cd == 1:
		ans += 1
ca1 = 0
cd1 = 0
ca2 = 0
cd2 = 0
for i in range(N):
	if S[i][i] == 'A':
		ca1 += 1
	if S[i][i] == '.':
		cd1 += 1
	if S[i][N - 1 - i] == 'A':
		ca2 += 1
	if S[i][N - 1 - i] == '.':
		cd2 += 1
if ca1 == N - 1 and cd1 == 1:
	ans += 1
if ca2 == N - 1 and cd2 == 1:
	ans += 1
print(ans)
0