結果

問題 No.910 素数部分列
ユーザー nasutarou1341nasutarou1341
提出日時 2019-10-18 21:47:31
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 150 ms / 1,000 ms
コード長 345 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 11,560 KB
最終ジャッジ日時 2023-09-08 04:08:56
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 15 ms
7,824 KB
testcase_03 AC 15 ms
7,804 KB
testcase_04 AC 15 ms
7,864 KB
testcase_05 AC 15 ms
7,716 KB
testcase_06 AC 15 ms
7,924 KB
testcase_07 AC 15 ms
7,928 KB
testcase_08 AC 15 ms
7,824 KB
testcase_09 AC 15 ms
7,732 KB
testcase_10 AC 15 ms
7,780 KB
testcase_11 AC 16 ms
7,828 KB
testcase_12 AC 15 ms
7,848 KB
testcase_13 AC 15 ms
7,816 KB
testcase_14 AC 14 ms
7,768 KB
testcase_15 AC 15 ms
7,808 KB
testcase_16 AC 15 ms
7,776 KB
testcase_17 AC 14 ms
7,780 KB
testcase_18 AC 15 ms
7,848 KB
testcase_19 AC 15 ms
7,788 KB
testcase_20 AC 16 ms
7,716 KB
testcase_21 AC 15 ms
7,812 KB
testcase_22 AC 15 ms
7,804 KB
testcase_23 AC 87 ms
10,268 KB
testcase_24 AC 87 ms
10,448 KB
testcase_25 AC 86 ms
10,364 KB
testcase_26 AC 89 ms
10,540 KB
testcase_27 AC 85 ms
10,192 KB
testcase_28 AC 90 ms
10,404 KB
testcase_29 AC 142 ms
11,560 KB
testcase_30 AC 144 ms
11,336 KB
testcase_31 AC 144 ms
11,116 KB
testcase_32 AC 141 ms
11,420 KB
testcase_33 AC 148 ms
11,424 KB
testcase_34 AC 149 ms
11,536 KB
testcase_35 AC 150 ms
11,528 KB
testcase_36 AC 148 ms
11,424 KB
testcase_37 AC 147 ms
11,408 KB
testcase_38 AC 148 ms
11,472 KB
testcase_39 AC 145 ms
11,400 KB
testcase_40 AC 143 ms
11,388 KB
testcase_41 AC 144 ms
11,432 KB
testcase_42 AC 141 ms
11,528 KB
testcase_43 AC 135 ms
11,516 KB
testcase_44 AC 142 ms
11,500 KB
testcase_45 AC 134 ms
11,340 KB
testcase_46 AC 139 ms
11,524 KB
testcase_47 AC 142 ms
11,376 KB
testcase_48 AC 122 ms
11,520 KB
testcase_49 AC 117 ms
11,428 KB
testcase_50 AC 117 ms
11,424 KB
testcase_51 AC 41 ms
9,764 KB
testcase_52 AC 143 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(input())

L = []
ans = 0
for i in S:
  if i == "3" or i == "5" or i == "7":
    ans += 1
  else:
    L.append(int(i))

o = 0
n = 0
for i in L:
  if i == 1:
    o += 1
  if i == 9:
    n += 1
    if o != 0:
      o -= 1
      n -= 1
      ans += 1

ans += min(n // 2, o)
o -= n // 2
if o > 0:
  ans += o // 2
print(ans)
0