結果
問題 |
No.910 素数部分列
|
ユーザー |
|
提出日時 | 2020-05-15 13:05:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 368 bytes |
コンパイル時間 | 2,387 ms |
コンパイル使用メモリ | 191,888 KB |
最終ジャッジ日時 | 2025-01-10 11:06:32 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 28 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; string s; cin>>n>>s; int ans=0; string t; rep(i,n){ if(s[i]=='1' || s[i]=='9') t+=s[i]; else ans++; } int cnt=0; rep(i,t.length()){ if(t[i]=='1') cnt++; else{ if(cnt>0) cnt--, ans++; } } ans+=cnt/2; printf("%d\n",ans); return 0; }