結果

問題 No.376 立方体のN等分 (2)
ユーザー mkawa2mkawa2
提出日時 2020-03-26 13:25:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 536 ms / 5,000 ms
コード長 1,032 bytes
コンパイル時間 1,768 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 78,276 KB
最終ジャッジ日時 2023-08-30 12:23:47
合計ジャッジ時間 12,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,364 KB
testcase_01 AC 96 ms
71,572 KB
testcase_02 AC 238 ms
76,636 KB
testcase_03 AC 241 ms
77,148 KB
testcase_04 AC 258 ms
76,872 KB
testcase_05 AC 94 ms
71,428 KB
testcase_06 AC 94 ms
71,728 KB
testcase_07 AC 92 ms
71,484 KB
testcase_08 AC 105 ms
76,736 KB
testcase_09 AC 131 ms
76,600 KB
testcase_10 AC 174 ms
77,308 KB
testcase_11 AC 170 ms
76,668 KB
testcase_12 AC 195 ms
76,932 KB
testcase_13 AC 198 ms
76,612 KB
testcase_14 AC 209 ms
76,464 KB
testcase_15 AC 221 ms
76,520 KB
testcase_16 AC 472 ms
78,276 KB
testcase_17 AC 235 ms
76,460 KB
testcase_18 AC 240 ms
76,908 KB
testcase_19 AC 249 ms
76,684 KB
testcase_20 AC 249 ms
76,716 KB
testcase_21 AC 497 ms
77,924 KB
testcase_22 AC 254 ms
76,640 KB
testcase_23 AC 507 ms
77,956 KB
testcase_24 AC 508 ms
77,936 KB
testcase_25 AC 260 ms
76,724 KB
testcase_26 AC 536 ms
77,944 KB
testcase_27 AC 262 ms
76,524 KB
testcase_28 AC 263 ms
76,696 KB
testcase_29 AC 264 ms
76,700 KB
testcase_30 AC 264 ms
76,628 KB
testcase_31 AC 263 ms
76,692 KB
testcase_32 AC 262 ms
76,520 KB
testcase_33 AC 262 ms
76,556 KB
testcase_34 AC 264 ms
76,712 KB
testcase_35 AC 263 ms
76,772 KB
testcase_36 AC 264 ms
76,652 KB
testcase_37 AC 264 ms
76,656 KB
testcase_38 AC 263 ms
76,792 KB
testcase_39 AC 263 ms
76,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    def fac(n):
        res=[]
        for d in range(1,n+1):
            if d**2>n:break
            if n%d==0:res.append(d)
        return res

    n=II()
    ff=fac(n)
    ans=10**16
    for i,f1 in enumerate(ff):
        for f2 in ff[i:]:
            if n//f1%f2:continue
            f3=n//f1//f2
            if f3<f2:break
            cur=f1+f2+f3-3
            if cur<ans:ans=cur
    print(ans,n-1)

main()
0