結果
| 問題 |
No.1312 Snake Eyes
|
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2020-11-09 23:43:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 508 bytes |
| コンパイル時間 | 694 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 16,256 KB |
| 最終ジャッジ日時 | 2024-07-23 21:11:58 |
| 合計ジャッジ時間 | 21,465 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 73 TLE * 1 -- * 11 |
ソースコード
n = int(input())
ans = n + 1
for i in range(1, 10 ** 6 + 1):
if n % i != 0:
continue
s = n // i
for j in range(2, 41):
lower = 1
upper = 10 ** 12
while lower + 1 < upper:
p = (lower + upper) // 2
sm = (p ** j - 1) // (p - 1)
if sm == s:
if i < p:
ans = min(ans, p)
break
if sm < s:
lower = p
else:
upper = p
print(ans)
りあん