結果
| 問題 |
No.1312 Snake Eyes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-16 09:18:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 385 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 61,568 KB |
| 最終ジャッジ日時 | 2024-12-29 21:28:15 |
| 合計ジャッジ時間 | 6,816 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 67 WA * 18 |
ソースコード
n=int(input())
if n<=10**6:
for i in range(2,n):
nn=n
t=nn%i
nn//=i
flg=True
while nn:
if t==nn%i:
nn//=i
else:
flg=False
break
if flg:
print(i)
exit()
else:
# ぞろ目になっても2桁を超えない
st=set()
for i in range(1,int(n**.5)+1):
if n%i==0:
st.add(i)
st.add(n//i)
ans=n-1
# n=x*(p+1)
# x:nの約数
for x in st:
p=n//x-1
if p**2>n and p>1 and n%p==(n//p)%p:
ans=min(ans,p)
print(ans)