結果

問題 No.910 素数部分列
コンテスト
ユーザー pluto77
提出日時 2019-11-19 11:06:12
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 103 ms / 1,000 ms
コード長 232 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 307 ms
コンパイル使用メモリ 77,528 KB
最終ジャッジ日時 2025-12-04 01:58:40
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#yuki910

n=int(raw_input())
s=raw_input()
res=0
one=nine=0
for c in s:
 if c=='1':
  one+=1
 elif c=='9':
  if one>0:
   res+=1
   one-=1
  else:
   nine+=1
 else:
  res+=1
res+=min(nine/2,one)
res+=max(0,(one-nine/2)/2)
print res
0