結果

問題 No.910 素数部分列
ユーザー brthyyjpbrthyyjp
提出日時 2022-02-10 17:07:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 1,000 ms
コード長 360 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 85,808 KB
最終ジャッジ日時 2023-09-08 06:25:51
合計ジャッジ時間 6,850 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,856 KB
testcase_01 AC 72 ms
71,448 KB
testcase_02 AC 73 ms
71,048 KB
testcase_03 AC 69 ms
71,252 KB
testcase_04 AC 73 ms
71,312 KB
testcase_05 AC 71 ms
71,092 KB
testcase_06 AC 72 ms
71,104 KB
testcase_07 AC 71 ms
71,176 KB
testcase_08 AC 72 ms
71,216 KB
testcase_09 AC 72 ms
71,336 KB
testcase_10 AC 72 ms
71,196 KB
testcase_11 AC 71 ms
70,856 KB
testcase_12 AC 71 ms
70,980 KB
testcase_13 AC 73 ms
71,212 KB
testcase_14 AC 71 ms
71,264 KB
testcase_15 AC 73 ms
71,312 KB
testcase_16 AC 73 ms
71,232 KB
testcase_17 AC 72 ms
70,984 KB
testcase_18 AC 71 ms
71,252 KB
testcase_19 AC 75 ms
70,856 KB
testcase_20 AC 71 ms
71,268 KB
testcase_21 AC 72 ms
71,136 KB
testcase_22 AC 73 ms
71,016 KB
testcase_23 AC 98 ms
85,300 KB
testcase_24 AC 102 ms
85,592 KB
testcase_25 AC 100 ms
85,468 KB
testcase_26 AC 98 ms
85,572 KB
testcase_27 AC 100 ms
85,212 KB
testcase_28 AC 96 ms
85,628 KB
testcase_29 AC 94 ms
85,488 KB
testcase_30 AC 84 ms
79,160 KB
testcase_31 AC 87 ms
79,196 KB
testcase_32 AC 87 ms
79,232 KB
testcase_33 AC 88 ms
79,140 KB
testcase_34 AC 93 ms
85,636 KB
testcase_35 AC 95 ms
85,800 KB
testcase_36 AC 94 ms
85,632 KB
testcase_37 AC 96 ms
85,620 KB
testcase_38 AC 95 ms
85,752 KB
testcase_39 AC 97 ms
85,736 KB
testcase_40 AC 98 ms
85,616 KB
testcase_41 AC 97 ms
85,468 KB
testcase_42 AC 97 ms
85,636 KB
testcase_43 AC 97 ms
85,576 KB
testcase_44 AC 98 ms
85,508 KB
testcase_45 AC 96 ms
85,808 KB
testcase_46 AC 103 ms
85,464 KB
testcase_47 AC 95 ms
85,688 KB
testcase_48 AC 80 ms
78,988 KB
testcase_49 AC 82 ms
79,020 KB
testcase_50 AC 82 ms
78,976 KB
testcase_51 AC 80 ms
78,884 KB
testcase_52 AC 82 ms
79,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(str(input()))

ans = 0
cnt1 = 0
cnt9 = 0
for c in s:
    if c == '3' or c == '5' or c == '7':
        ans += 1
    elif c == '9':
        if cnt1:
            cnt1 -= 1
            ans += 1
        else:
            cnt9 += 1
    else:
        cnt1 += 1

q = cnt9//2
ans += min(q, cnt1)
cnt1 -= min(q, cnt1)
ans += cnt1//2
print(ans)
0