結果
問題 | No.910 素数部分列 |
ユーザー |
|
提出日時 | 2019-11-19 11:06:12 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 46 ms / 1,000 ms |
コード長 | 232 bytes |
コンパイル時間 | 112 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 06:23:15 |
合計ジャッジ時間 | 3,159 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
#yuki910n=int(raw_input())s=raw_input()res=0one=nine=0for c in s:if c=='1':one+=1elif c=='9':if one>0:res+=1one-=1else:nine+=1else:res+=1res+=min(nine/2,one)res+=max(0,(one-nine/2)/2)print res