結果

問題 No.1312 Snake Eyes
ユーザー sepa38sepa38
提出日時 2023-03-23 10:57:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 62,164 KB
最終ジャッジ日時 2023-10-18 19:27:02
合計ジャッジ時間 15,598 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,576 KB
testcase_01 AC 36 ms
53,492 KB
testcase_02 AC 37 ms
53,492 KB
testcase_03 AC 37 ms
53,492 KB
testcase_04 AC 37 ms
53,492 KB
testcase_05 AC 37 ms
53,492 KB
testcase_06 AC 37 ms
53,492 KB
testcase_07 AC 37 ms
53,492 KB
testcase_08 AC 37 ms
53,492 KB
testcase_09 AC 37 ms
53,492 KB
testcase_10 AC 37 ms
53,492 KB
testcase_11 AC 37 ms
53,492 KB
testcase_12 AC 36 ms
53,492 KB
testcase_13 AC 36 ms
53,492 KB
testcase_14 AC 37 ms
53,492 KB
testcase_15 AC 37 ms
53,492 KB
testcase_16 AC 37 ms
53,492 KB
testcase_17 AC 38 ms
53,492 KB
testcase_18 AC 37 ms
53,492 KB
testcase_19 AC 37 ms
53,492 KB
testcase_20 AC 37 ms
53,492 KB
testcase_21 AC 38 ms
53,492 KB
testcase_22 AC 37 ms
53,492 KB
testcase_23 AC 43 ms
59,864 KB
testcase_24 AC 42 ms
59,788 KB
testcase_25 AC 41 ms
59,788 KB
testcase_26 AC 41 ms
59,788 KB
testcase_27 AC 41 ms
59,788 KB
testcase_28 AC 42 ms
59,788 KB
testcase_29 AC 42 ms
59,788 KB
testcase_30 AC 42 ms
59,788 KB
testcase_31 AC 42 ms
59,788 KB
testcase_32 AC 42 ms
59,788 KB
testcase_33 AC 38 ms
53,492 KB
testcase_34 AC 42 ms
59,788 KB
testcase_35 AC 42 ms
59,788 KB
testcase_36 AC 42 ms
59,788 KB
testcase_37 AC 42 ms
59,788 KB
testcase_38 AC 54 ms
62,068 KB
testcase_39 AC 49 ms
59,816 KB
testcase_40 AC 51 ms
62,020 KB
testcase_41 AC 58 ms
62,068 KB
testcase_42 AC 45 ms
59,816 KB
testcase_43 AC 47 ms
59,816 KB
testcase_44 AC 45 ms
59,816 KB
testcase_45 AC 49 ms
62,020 KB
testcase_46 AC 47 ms
59,816 KB
testcase_47 AC 43 ms
59,796 KB
testcase_48 TLE -
testcase_49 AC 586 ms
62,068 KB
testcase_50 AC 193 ms
62,068 KB
testcase_51 AC 119 ms
59,816 KB
testcase_52 AC 165 ms
59,816 KB
testcase_53 AC 338 ms
62,068 KB
testcase_54 AC 248 ms
59,816 KB
testcase_55 AC 96 ms
59,816 KB
testcase_56 AC 964 ms
62,068 KB
testcase_57 AC 114 ms
59,816 KB
testcase_58 AC 386 ms
62,068 KB
testcase_59 AC 235 ms
62,068 KB
testcase_60 AC 82 ms
62,068 KB
testcase_61 AC 488 ms
62,068 KB
testcase_62 AC 218 ms
62,068 KB
testcase_63 AC 46 ms
59,816 KB
testcase_64 AC 55 ms
62,068 KB
testcase_65 AC 52 ms
59,816 KB
testcase_66 AC 42 ms
59,788 KB
testcase_67 AC 37 ms
53,492 KB
testcase_68 AC 48 ms
59,816 KB
testcase_69 AC 45 ms
59,816 KB
testcase_70 AC 761 ms
62,068 KB
testcase_71 AC 263 ms
62,068 KB
testcase_72 AC 66 ms
62,068 KB
testcase_73 AC 45 ms
59,816 KB
testcase_74 AC 42 ms
59,788 KB
testcase_75 AC 45 ms
59,816 KB
testcase_76 TLE -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 1:
  print(2)
  exit()
if n == 2:
	print(3)
	exit()
ans = n - 1
for k in range(1, n+10):
  if k ** 2 > n:
    break
  if n % k:
  	continue
  for j in range(1, n):
  	p = (n - k) // j
  	if p <= k or j ** 2 > n:
  		break
  	if (n - k) % j:
  		continue
  	tmp = n
  	flg = 1
  	while tmp:
  		if tmp % p != k:
  			flg = 0
  			break
  		tmp //= p
  	if flg:
  		ans = min(ans, p)
  	p = j
  	tmp = n
  	flg = 1
  	while tmp:
  		if tmp % p != k:
  			flg = 0
  			break
  		tmp //= p
  	if flg:
  		ans = min(ans, p)
print(ans)
0