結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:39:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 211 ms / 5,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 65,096 KB |
最終ジャッジ日時 | 2025-04-15 22:41:27 |
合計ジャッジ時間 | 3,596 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
import math N = int(input()) tmax = N - 1 tmin = float('inf') a_max = int(N ** (1/3)) + 2 # Adding 2 to ensure we cover the cube root for a in range(1, a_max + 1): if N % a != 0: continue M = N // a b_max = int(math.isqrt(M)) for b in range(a, b_max + 1): if M % b != 0: continue c = M // b if b <= c: current_sum = a + b + c if current_sum < tmin: tmin = current_sum # Ensure the minimal case is considered even if all factors are larger than cube root if tmin == float('inf'): tmin = 1 + 1 + N # Fallback to 1,1,N case tmin -= 3 print(tmin, tmax)