結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-04-12 17:08:38 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 641 bytes |
| コンパイル時間 | 4,170 ms |
| コンパイル使用メモリ | 251,720 KB |
| 最終ジャッジ日時 | 2025-02-12 05:16:27 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 28 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=1444999999999999;
ll mod=998244353;
int main(){
ll n;
cin >> n;
string s;
cin >> s;
ll ans=0;
ll x=0,y=0;
for (ll i = 0; i < s.size(); i++)
{
if (s[i]=='3'||s[i]=='5'||s[i]=='7')
{
ans+=1;
}else if (s[i]=='1')
{
x+=1;
}else{
if (x>0)
{
ans+=1;
x-=1;
}
}
}
ans+=x/2;
cout << ans << endl;
}
hiro71687k