結果

問題 No.2785 四乗足す四の末尾の0
ユーザー Prala
提出日時 2024-08-10 00:51:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 79,032 KB
最終ジャッジ日時 2024-08-10 00:51:23
合計ジャッジ時間 3,920 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def two(n):
	cnt = 0
	while not n % 2:
		n //= 2
		cnt += 1
	return cnt

def fiv(n):
	cnt = 0
	while not n % 5:
		n //= 5
		cnt += 1
	return cnt

for i in range(T):
	N = int(input())
	if abs(N) == 1:
		print("Yes")
		print(0)
		exit()
	A = N**2-2*N+2
	B = N**2+2*N+2
	print("No")
	print(min(two(A)+two(B), fiv(A)+fiv(B)))
0