結果

問題 No.910 素数部分列
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-06-14 00:37:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 10,040 KB
最終ジャッジ日時 2023-09-08 09:59:31
合計ジャッジ時間 7,575 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,220 KB
testcase_01 AC 16 ms
8,228 KB
testcase_02 AC 16 ms
8,120 KB
testcase_03 AC 16 ms
8,272 KB
testcase_04 AC 16 ms
8,240 KB
testcase_05 AC 17 ms
8,296 KB
testcase_06 WA -
testcase_07 AC 16 ms
8,124 KB
testcase_08 AC 15 ms
8,236 KB
testcase_09 AC 20 ms
8,164 KB
testcase_10 AC 16 ms
8,288 KB
testcase_11 AC 16 ms
8,148 KB
testcase_12 AC 16 ms
8,104 KB
testcase_13 AC 16 ms
8,296 KB
testcase_14 AC 16 ms
8,124 KB
testcase_15 AC 16 ms
8,128 KB
testcase_16 AC 16 ms
8,220 KB
testcase_17 AC 15 ms
8,240 KB
testcase_18 AC 16 ms
8,148 KB
testcase_19 AC 16 ms
8,184 KB
testcase_20 AC 16 ms
8,164 KB
testcase_21 AC 16 ms
8,184 KB
testcase_22 AC 16 ms
8,104 KB
testcase_23 AC 134 ms
9,752 KB
testcase_24 AC 136 ms
9,896 KB
testcase_25 AC 136 ms
9,928 KB
testcase_26 AC 134 ms
9,956 KB
testcase_27 AC 133 ms
9,832 KB
testcase_28 AC 139 ms
9,876 KB
testcase_29 WA -
testcase_30 AC 173 ms
9,852 KB
testcase_31 AC 171 ms
9,784 KB
testcase_32 AC 174 ms
9,948 KB
testcase_33 AC 179 ms
9,936 KB
testcase_34 WA -
testcase_35 AC 174 ms
9,972 KB
testcase_36 WA -
testcase_37 AC 170 ms
9,852 KB
testcase_38 WA -
testcase_39 AC 170 ms
9,888 KB
testcase_40 WA -
testcase_41 AC 169 ms
9,856 KB
testcase_42 WA -
testcase_43 AC 164 ms
9,820 KB
testcase_44 AC 168 ms
9,800 KB
testcase_45 AC 177 ms
9,936 KB
testcase_46 AC 170 ms
9,860 KB
testcase_47 AC 171 ms
10,008 KB
testcase_48 AC 141 ms
9,820 KB
testcase_49 AC 133 ms
9,940 KB
testcase_50 AC 136 ms
9,856 KB
testcase_51 AC 113 ms
9,964 KB
testcase_52 AC 166 ms
9,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# problem 1
N = int(input())
S = list(input())
ans = 0
dic = {"1": 0, "3": 0, "5": 0, "7": 0, "9": 0}
for some in S:
    dic[some] += 1

ans = dic["3"]+dic["5"]+dic["7"]
new = {1: 0, 9: 0}
for x in S:
    n = int(x)
    if n == 1: new[1] += 1
    if n == 9:
        new[9] += 1
        if new[1] > 0:
            new[1] -= 1
            new[9] -= 1
            ans += 1

if new[9] >= new[1]**2:
    ans += new[1]
    print(ans)
    exit()
    
elif new[9] < new[1]**2:
    p = new[9]//2
    ans += p
    new[1] -= p
    ans += new[1]//2
    print(ans)
    exit()
0