結果
問題 | No.910 素数部分列 |
ユーザー |
![]() |
提出日時 | 2020-04-02 00:05:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 357 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-06-27 12:56:59 |
合計ジャッジ時間 | 4,515 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 50 |
ソースコード
n=int(input()) s=input() ans=0 c="" for i in s: if i == "3" or "5" or "7": ans+=1 else: c+=i end9=-1 cnt=0 for i in range(len(c))[::-1]: if c[i]=="9" and end9==-1:end9=i;cnt+=1 if c[i]=="9":cnt+=1 if end9 == -1: print(ans+len(c)//2) else: ans+=min(end9+1-cnt,cnt) print(ans+(len(c)-end9-1)//2)