結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2019-10-19 19:19:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 487 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 166,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 15:28:31 |
合計ジャッジ時間 | 3,277 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 32 WA * 18 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; string s; cin >> s; int ans=0; for(int i=0;i<N;i++){ if(s[i]=='3'||s[i]=='5'||s[i]=='7'){ ans++; } } int cnt_nine=0; int cnt_one=0; for(int i=0;i<N;i++){ if(s[i]=='1') cnt_one++; if(s[i]=='9') cnt_nine++; } ans+=min(cnt_one,cnt_nine); if(cnt_one>cnt_nine){ ans+=(cnt_one-cnt_nine)/2; } cout << ans << endl; }