結果

問題 No.910 素数部分列
ユーザー roarisroaris
提出日時 2019-10-21 23:07:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 1,000 ms
コード長 398 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 76,712 KB
最終ジャッジ日時 2023-09-15 15:08:45
合計ジャッジ時間 6,296 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,440 KB
testcase_01 AC 70 ms
71,420 KB
testcase_02 AC 70 ms
71,376 KB
testcase_03 AC 68 ms
71,156 KB
testcase_04 AC 69 ms
71,288 KB
testcase_05 AC 69 ms
71,376 KB
testcase_06 AC 71 ms
71,096 KB
testcase_07 AC 71 ms
71,212 KB
testcase_08 AC 70 ms
71,324 KB
testcase_09 AC 69 ms
71,356 KB
testcase_10 AC 71 ms
71,144 KB
testcase_11 AC 71 ms
71,308 KB
testcase_12 AC 68 ms
71,324 KB
testcase_13 AC 70 ms
71,300 KB
testcase_14 AC 70 ms
71,276 KB
testcase_15 AC 71 ms
71,284 KB
testcase_16 AC 69 ms
71,152 KB
testcase_17 AC 71 ms
71,212 KB
testcase_18 AC 71 ms
71,412 KB
testcase_19 AC 70 ms
71,092 KB
testcase_20 AC 70 ms
71,376 KB
testcase_21 AC 70 ms
70,996 KB
testcase_22 AC 73 ms
71,344 KB
testcase_23 AC 88 ms
76,300 KB
testcase_24 AC 89 ms
76,468 KB
testcase_25 AC 90 ms
76,500 KB
testcase_26 AC 89 ms
76,672 KB
testcase_27 AC 88 ms
76,604 KB
testcase_28 AC 86 ms
76,480 KB
testcase_29 AC 84 ms
76,400 KB
testcase_30 AC 84 ms
76,712 KB
testcase_31 AC 84 ms
76,448 KB
testcase_32 AC 84 ms
76,288 KB
testcase_33 AC 84 ms
76,580 KB
testcase_34 AC 85 ms
76,436 KB
testcase_35 AC 84 ms
76,568 KB
testcase_36 AC 84 ms
76,296 KB
testcase_37 AC 85 ms
76,552 KB
testcase_38 AC 84 ms
76,444 KB
testcase_39 AC 85 ms
76,444 KB
testcase_40 AC 85 ms
76,548 KB
testcase_41 AC 86 ms
76,476 KB
testcase_42 AC 85 ms
76,608 KB
testcase_43 AC 83 ms
76,432 KB
testcase_44 AC 85 ms
76,588 KB
testcase_45 AC 85 ms
76,440 KB
testcase_46 AC 88 ms
76,628 KB
testcase_47 AC 87 ms
76,572 KB
testcase_48 AC 80 ms
76,532 KB
testcase_49 AC 81 ms
76,392 KB
testcase_50 AC 79 ms
76,512 KB
testcase_51 AC 77 ms
76,216 KB
testcase_52 AC 82 ms
76,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
one, nine, prime, match = 0, 0, 0, 0

for i in range(N):
    if S[i] in ['3', '5', '7']:
        prime += 1
    elif S[i] == '1':
        one += 1
    elif S[i] == '9':
        if one > 0:
            one -= 1
            match += 1
        else:
            nine += 1

if one >= nine//2:
    print(prime+match+nine//2+(one-nine//2)//2)
else:
    print(prime+match+one)
0