結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2020-08-24 22:10:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 351 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-11-06 10:47:54 |
合計ジャッジ時間 | 5,760 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 31 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) S=input() ans=0 C=[0,0,0] for s in S: if s=="3" or s=="7": ans+=1 if s=="5": C[1]+=1 if s=="1": if C[2]>=2: ans+=1 C[2]-=2 else: C[0]+=1 if s=="9": if C[1]>0: ans+=1 C[1]-=1 elif C[0]>0: ans+=1 C[0]-=1 else: C[2]+=1 ans+=C[0]//2 print(ans)