結果
| 問題 |
No.376 立方体のN等分 (2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-05 10:29:21 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 782 ms / 5,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 1,650 ms |
| コンパイル使用メモリ | 76,932 KB |
| 実行使用メモリ | 77,864 KB |
| 最終ジャッジ日時 | 2024-11-06 22:04:20 |
| 合計ジャッジ時間 | 9,684 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 38 |
ソースコード
input = raw_input
range = xrange
N = int(input())
record = N - 1
max_a = int(N**(1.0/3.0)) + 2
for a in range(max_a, 0, -1):
if N % a:
continue
bc = N // a
max_b = int(bc ** 0.5) + 1
if max_b * 2 + a - 6 > record:
break
for b in range(max_b, 0, -1):
if bc % b:
continue
c = bc // b
score = a + b + c - 3
if score < record:
record = score
print('{} {}'.format(record, N - 1))