結果

問題 No.312 置換処理
ユーザー ronpooronpoo
提出日時 2023-09-08 10:15:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 97,204 KB
最終ジャッジ日時 2023-09-08 10:15:14
合計ジャッジ時間 7,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
92,344 KB
testcase_01 AC 112 ms
90,740 KB
testcase_02 AC 120 ms
96,908 KB
testcase_03 AC 125 ms
97,204 KB
testcase_04 AC 77 ms
71,816 KB
testcase_05 AC 118 ms
96,908 KB
testcase_06 AC 105 ms
89,156 KB
testcase_07 AC 114 ms
94,656 KB
testcase_08 AC 111 ms
93,876 KB
testcase_09 AC 95 ms
83,676 KB
testcase_10 AC 97 ms
85,080 KB
testcase_11 AC 113 ms
94,112 KB
testcase_12 AC 100 ms
88,692 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 74 ms
71,992 KB
testcase_23 WA -
testcase_24 AC 75 ms
71,704 KB
testcase_25 AC 76 ms
71,852 KB
testcase_26 AC 75 ms
71,864 KB
testcase_27 AC 76 ms
71,836 KB
testcase_28 AC 76 ms
71,960 KB
testcase_29 AC 76 ms
71,920 KB
testcase_30 AC 90 ms
78,364 KB
testcase_31 WA -
testcase_32 AC 85 ms
77,672 KB
testcase_33 AC 95 ms
82,568 KB
testcase_34 AC 92 ms
82,584 KB
testcase_35 AC 90 ms
82,596 KB
testcase_36 AC 73 ms
71,752 KB
testcase_37 AC 74 ms
71,888 KB
testcase_38 WA -
testcase_39 AC 91 ms
82,152 KB
testcase_40 AC 80 ms
76,860 KB
testcase_41 AC 79 ms
71,700 KB
testcase_42 AC 82 ms
76,624 KB
testcase_43 AC 73 ms
71,696 KB
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

# 素数列挙
def prime(x):
    prime = [x if x%2==1 else 2 for x in range(x+1)]
    prime[0] = 1

    for i in range(3, int(x**0.5)+2, 2):
        if prime[i] != i:
            continue   
        for j in range(2*i, x+1, i):
            if prime[j] == j:
                prime[j] = i

    p = {i for i in range(2, x+1) if prime[i] == i}
    return p

p = prime(int(N**0.5)+10)
p = sorted(p)
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