結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2020-04-02 00:11:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 354 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,860 KB |
最終ジャッジ日時 | 2024-06-27 12:58:17 |
合計ジャッジ時間 | 31,110 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 19 TLE * 22 |
ソースコード
n=int(input()) s=input() ans=0 c="" for i in s: if i == "3" or i == "5" or i == "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+=max(min(end9+1-cnt,cnt),0) print(ans+(len(c)-end9-1)//2)