結果

問題 No.2785 四乗足す四の末尾の0
ユーザー 👑 p-adicp-adic
提出日時 2023-02-24 01:45:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 429 bytes
コンパイル時間 1,693 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 79,984 KB
最終ジャッジ日時 2023-10-01 00:40:45
合計ジャッジ時間 12,133 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,964 KB
testcase_01 AC 77 ms
71,324 KB
testcase_02 AC 75 ms
71,032 KB
testcase_03 AC 75 ms
71,040 KB
testcase_04 AC 77 ms
71,132 KB
testcase_05 AC 75 ms
70,836 KB
testcase_06 AC 76 ms
71,144 KB
testcase_07 AC 74 ms
71,160 KB
testcase_08 AC 76 ms
71,200 KB
testcase_09 AC 77 ms
71,300 KB
testcase_10 AC 76 ms
71,140 KB
testcase_11 AC 75 ms
71,116 KB
testcase_12 AC 79 ms
71,080 KB
testcase_13 AC 120 ms
76,860 KB
testcase_14 AC 291 ms
78,816 KB
testcase_15 AC 1,672 ms
79,984 KB
testcase_16 AC 76 ms
71,108 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 誤解法(フェルマーテスト)チェック
T = int(input())
Yes = "Yes"
No = "No"
for t in range(T):
	N = int(input())
	if ( N == 1 ) or ( N == -1 ):
		print( Yes )
		print( 0 )
	else:
		N *= N
		N2 = max( N , 2 )
		N *= N
		N += 4
		count = 0
		while N % 10 == 0:
			N //= 10
			count += 1
		if count > 0:
			print( No )
			print( count )
		else:
			print( Yes if( pow( 2 , N - 1 , N ) == 1 ) else No )
			print( 0 )
0