結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2019-10-18 21:43:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 106 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,928 KB |
最終ジャッジ日時 | 2024-06-25 15:20:40 |
合計ジャッジ時間 | 6,959 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 28 |
ソースコード
N=int(input()) S=input() ANS=0 REST=[] for x in S: if x in {"3","5","7"}: ANS+=1 else: REST.append(x) ONE=0 NINE=0 LEN=len(REST) count19=0 while True: while ONE<LEN and REST[ONE]!="1": ONE+=1 NINE=max(ONE,NINE) while NINE<LEN and REST[NINE]!="9": NINE+=1 if ONE==LEN or NINE==LEN: break else: count19+=1 ONE+=1 NINE+=1 count1=REST.count("1") ANS+=count19+(count1-count19)//2 print(ANS)