結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2019-10-18 22:59:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 470 bytes |
| コンパイル時間 | 456 ms |
| コンパイル使用メモリ | 65,764 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-25 18:34:44 |
| 合計ジャッジ時間 | 2,073 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 42 |
ソースコード
#include <iostream>
using namespace std;
int main(){
int n;
string s;cin>>n>>s;
int ans = 0;
for(int i = 0; n > i; i++){
if(s[i] == '3' || s[i] == '5' || s[i] == '7')ans++;
}
string z;
for(int i = 0; n > i; i++){
if(s[i] == '3' || s[i] == '5' || s[i] == '7')continue;
z.push_back(s[i]);
}
for(int i = 0; z.size() > i; i++){
if(z[i] == '1'){
if(i+1!=z.size()){
ans++;
i++;
}
}
}
cout << ans << endl;
}