結果

問題 No.1312 Snake Eyes
ユーザー shotoyoo
提出日時 2020-12-09 00:19:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 65,516 KB
最終ジャッジ日時 2024-09-18 22:07:57
合計ジャッジ時間 8,295 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 2 TLE * 1 -- * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
ans = float("inf")
for x in range(1,n+1):
    if (n-x)%x==0:
        p = (n-x)//x
        if x<p:
            ans = min(ans, p)
    if x>=p:
        break
for p in range(2, n+1):
    if p*p>n:
        break
    v = 1
    val = 0
    for i in range(100):
        val += v
        v *= p
        if val>n:
            break
        if n%val==0 and n//val<p:
            ans = min(ans, p)
print(ans)
0