結果

問題 No.312 置換処理
ユーザー ronpooronpoo
提出日時 2023-09-08 10:20:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 75,672 KB
最終ジャッジ日時 2023-09-08 10:20:35
合計ジャッジ時間 5,670 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
75,260 KB
testcase_01 AC 83 ms
75,296 KB
testcase_02 AC 88 ms
75,328 KB
testcase_03 AC 90 ms
75,184 KB
testcase_04 AC 72 ms
71,344 KB
testcase_05 AC 90 ms
75,672 KB
testcase_06 AC 81 ms
75,416 KB
testcase_07 AC 86 ms
75,328 KB
testcase_08 AC 88 ms
75,188 KB
testcase_09 AC 78 ms
75,432 KB
testcase_10 AC 79 ms
75,168 KB
testcase_11 AC 86 ms
75,260 KB
testcase_12 AC 82 ms
75,224 KB
testcase_13 AC 88 ms
75,184 KB
testcase_14 AC 84 ms
75,188 KB
testcase_15 AC 83 ms
75,512 KB
testcase_16 AC 78 ms
75,432 KB
testcase_17 AC 84 ms
75,524 KB
testcase_18 AC 84 ms
75,376 KB
testcase_19 AC 86 ms
75,300 KB
testcase_20 AC 86 ms
75,504 KB
testcase_21 AC 88 ms
75,620 KB
testcase_22 AC 68 ms
71,096 KB
testcase_23 AC 70 ms
71,240 KB
testcase_24 AC 70 ms
71,092 KB
testcase_25 AC 70 ms
71,172 KB
testcase_26 AC 70 ms
70,956 KB
testcase_27 AC 73 ms
71,180 KB
testcase_28 AC 70 ms
71,060 KB
testcase_29 AC 70 ms
71,336 KB
testcase_30 AC 74 ms
75,172 KB
testcase_31 AC 74 ms
75,328 KB
testcase_32 AC 73 ms
75,296 KB
testcase_33 AC 77 ms
75,324 KB
testcase_34 AC 80 ms
75,276 KB
testcase_35 AC 76 ms
75,232 KB
testcase_36 AC 69 ms
71,176 KB
testcase_37 AC 71 ms
71,328 KB
testcase_38 AC 69 ms
71,260 KB
testcase_39 AC 77 ms
75,300 KB
testcase_40 AC 75 ms
75,300 KB
testcase_41 AC 69 ms
71,104 KB
testcase_42 AC 74 ms
75,296 KB
testcase_43 AC 70 ms
71,260 KB
testcase_44 AC 69 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

p = make_divisors(N)
p.sort()
for v in p:
    if v > 2 and N % v == 0:
        ans = v
        break
else:
    if N % 2 == 0:
        ans = N // 2
    else:
        ans = N
print(ans)
0