結果

問題 No.2785 四乗足す四の末尾の0
ユーザー Prala
提出日時 2024-08-10 00:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 417 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,024 KB
実行使用メモリ 79,088 KB
最終ジャッジ日時 2024-08-10 00:57:46
合計ジャッジ時間 4,032 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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)
		continue
	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