結果

問題 No.312 置換処理
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-25 23:58:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 629 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,888 KB
最終ジャッジ日時 2024-04-27 10:53:45
合計ジャッジ時間 7,669 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
16,896 KB
testcase_01 AC 426 ms
18,432 KB
testcase_02 AC 622 ms
21,888 KB
testcase_03 AC 629 ms
21,888 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 130 ms
18,688 KB
testcase_06 AC 292 ms
15,616 KB
testcase_07 AC 464 ms
18,816 KB
testcase_08 AC 271 ms
17,280 KB
testcase_09 AC 102 ms
13,952 KB
testcase_10 AC 179 ms
14,464 KB
testcase_11 AC 450 ms
17,792 KB
testcase_12 AC 142 ms
15,488 KB
testcase_13 AC 122 ms
18,176 KB
testcase_14 AC 98 ms
16,256 KB
testcase_15 AC 92 ms
15,488 KB
testcase_16 AC 67 ms
13,696 KB
testcase_17 AC 106 ms
16,896 KB
testcase_18 AC 108 ms
16,768 KB
testcase_19 AC 119 ms
17,664 KB
testcase_20 AC 128 ms
18,432 KB
testcase_21 AC 134 ms
18,816 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 32 ms
11,008 KB
testcase_24 AC 31 ms
10,880 KB
testcase_25 AC 32 ms
11,008 KB
testcase_26 AC 30 ms
10,880 KB
testcase_27 AC 31 ms
10,880 KB
testcase_28 AC 30 ms
10,880 KB
testcase_29 AC 30 ms
10,880 KB
testcase_30 AC 90 ms
12,416 KB
testcase_31 AC 50 ms
12,416 KB
testcase_32 AC 74 ms
12,032 KB
testcase_33 AC 178 ms
14,592 KB
testcase_34 AC 190 ms
14,464 KB
testcase_35 AC 150 ms
13,568 KB
testcase_36 AC 31 ms
11,008 KB
testcase_37 AC 30 ms
10,880 KB
testcase_38 AC 30 ms
10,880 KB
testcase_39 AC 77 ms
13,184 KB
testcase_40 AC 44 ms
11,392 KB
testcase_41 AC 30 ms
10,880 KB
testcase_42 AC 37 ms
11,264 KB
testcase_43 AC 34 ms
10,880 KB
testcase_44 AC 32 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N=int(input())

#素数の表の作成
n_sqrt = math.ceil(math.sqrt(N))
isPrime = [True for i in range(n_sqrt+1)]
primes = []
primes.append(2)

for i in range(4,n_sqrt+1,2):
    isPrime[i]=False

#2
if N%2==0:
    N=int(N/2)
    if N%2==0:
        if N%3==0:
            print(3)
        else:
            print(4)
        exit()

#3以上
for i in range(3,n_sqrt+1,2):
    if isPrime[i]==True:
        primes.append(i)
        if N%i==0:
            print(i)
            exit()
        for j in range(i+i,n_sqrt,i):
            isPrime[j]=False
print(N)
0