結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
polyomino_24
|
| 提出日時 | 2019-10-18 23:12:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,468 bytes |
| コンパイル時間 | 1,477 ms |
| コンパイル使用メモリ | 120,444 KB |
| 最終ジャッジ日時 | 2025-01-07 23:46:12 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 43 |
ソースコード
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
os << '(' << a.first << ',' << a.second << ')';
return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
for (auto x : v) os << x << ' ';
return os;
}
void debug() {
cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
cerr << a;
if (sizeof...(b)) cerr << ", ";
debug(b...);
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
string s;
cin >> s;
int ans = 0;
int cnt1 = 0, cnt9 = 0;
rep(i,n){
if(s[i] == '3' or s[i] == '5' or s[i] == '7')ans++;
else if(s[i] == '1')cnt1++;
else cnt9++;
}
ans += cnt1/2;
if(cnt1&1 and cnt9)ans++;
cout << ans << endl;
}
polyomino_24