結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2019-10-18 21:36:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 1,762 ms |
コンパイル使用メモリ | 167,056 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 15:10:38 |
合計ジャッジ時間 | 3,677 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 43 |
ソースコード
#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]; ans += cnt[0]/2; cnt[0] -= cnt[0]/2*2; if(cnt[0] && cnt[4]) ans++; cout << ans << endl; }