結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2016-06-05 11:51:57 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 326 ms / 5,000 ms |
| コード長 | 769 bytes |
| コンパイル時間 | 95 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-11 21:03:11 |
| 合計ジャッジ時間 | 4,306 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#!/usr/bin/env python3
import math
def divisors(n):
xs = []
for i in range(1, math.ceil(math.sqrt(n)) + 1):
d, m = divmod(n, i)
if m == 0:
xs.append(i)
if i * i != n:
xs.append(d)
xs.sort()
return xs
def compute_max(n):
return n - 1
def compute_min(n):
ds = divisors(n)
ans = compute_max(n)
for a in ds:
if a * a * a > n:
break
for b in ds:
if a * b * b > n:
break
c, m = divmod(n, a * b)
if m == 0:
ans = min(ans, a + b + c - 3)
return ans
def main():
n = int(input())
print("{} {}".format(compute_min(n), compute_max(n)))
if __name__ == '__main__':
main()
はむ吉🐹