結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
totori_nyaa
|
| 提出日時 | 2019-10-18 21:40:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 646 bytes |
| コンパイル時間 | 1,592 ms |
| コンパイル使用メモリ | 167,748 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-25 15:16:41 |
| 合計ジャッジ時間 | 2,945 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(20);
int n;
string s;
cin>>n>>s;
ll ans = 0;
string num = "13579";
ll cnt[5]={};
for(int i=0;i<n;i++){
for(int j=0;j<5;j++){
if(s[i]==num[j]){
cnt[j]++;
}
}
}
ans += cnt[1] + cnt[2] + cnt[3];
ll t=0;
for(int i=0;i<n;i++){
if(s[i]=='1') t++;
if(s[i]=='9' && t){
ans++;
t--;
}
}
ans += t/2;
cout << ans << endl;
}
totori_nyaa