結果

問題 No.375 立方体のN等分 (1)
ユーザー taruphotarupho
提出日時 2016-06-05 14:09:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-17 04:48:07
合計ジャッジ時間 5,132 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 33 ms
10,624 KB
testcase_02 WA -
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 34 ms
10,624 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 84 ms
10,624 KB
testcase_10 AC 101 ms
10,624 KB
testcase_11 AC 104 ms
10,624 KB
testcase_12 AC 119 ms
10,752 KB
testcase_13 AC 123 ms
10,624 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 132 ms
10,752 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 142 ms
10,752 KB
testcase_20 AC 142 ms
10,624 KB
testcase_21 AC 140 ms
10,624 KB
testcase_22 WA -
testcase_23 AC 159 ms
10,752 KB
testcase_24 AC 147 ms
10,752 KB
testcase_25 WA -
testcase_26 AC 154 ms
10,752 KB
testcase_27 AC 158 ms
10,624 KB
testcase_28 AC 156 ms
10,752 KB
testcase_29 AC 155 ms
10,624 KB
testcase_30 AC 156 ms
10,624 KB
testcase_31 AC 157 ms
10,624 KB
testcase_32 AC 157 ms
10,752 KB
testcase_33 AC 150 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=[]
M=n
p=2

while p <= M**0.5:

    while n%p ==0:
        a.append(p)
        n = n//p
        
        if n==1:
            break
    p += 1

if n!=1:
    a.append(n)

if len(a)==0:
    a.append(M)
 
while len(a)>3:
    a.sort()
    min1=a.pop(0)
    min2=a.pop(0)
    a.append(min1*min2)

ans1=0
for i in a:
    ans1 += i-1

print(ans1,M-1)
0