結果
| 問題 | No.3757 Happy End |
| コンテスト | |
| ユーザー |
ei13333333
|
| 提出日時 | 2026-09-26 18:57:45 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 2,296 bytes |
| 記録 | |
| コンパイル時間 | 2,070 ms |
| コンパイル使用メモリ | 353,104 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-10-09 20:51:10 |
| 合計ジャッジ時間 | 4,291 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n, m) for (int i = n; i < (int)m; ++i)
#define REP(i, n) FOR(i, 0, n)
#define REP_1(i, n) for (int i = 1; i <= (int)n; ++i)
#define RFOR(i, n, m) for (int i = (int)n - 1; i >= (int)m; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREP_1(i, n) for (int i = (int)n; i >= 1; --i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define SIZE(v) (int)v.size()
#define EMPTY(v) v.empty()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(RALL(v))
#define REVERSE(v) reverse(ALL(v))
#define UNIQUE(v) (SORT(v), v.erase(unique(ALL(v)), v.end()))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define YES() cout << "YES\n"
#define NO() cout << "NO\n"
#define Yes() cout << "Yes\n"
#define No() cout << "No\n"
#define YESNO(cond) cout << ((cond) ? "YES" : "NO") << '\n'
#define YesNo(cond) cout << ((cond) ? "Yes" : "No") << '\n'
#define IN(x, a, b) ((a) <= (x) && (x) < (b))
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
#define FASTIO() \
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define PRECISION(n) cout << fixed << setprecision(n)
using P = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> using max_queue = priority_queue<T>;
constexpr ll INF = 1000000000;
constexpr ll INFL = (ll)1000000000000001000LL;
constexpr ll MOD = 998244353;
constexpr ld PI = 3.141592653589793238462643383279;
constexpr ld EPS = 1e-9;
constexpr int dx4[] = {-1, 1, 0, 0};
constexpr int dy4[] = {0, 0, -1, 1};
constexpr int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1};
constexpr int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
void solve() {
int n;
string s;
cin >> n >> s;
int ans = 0;
if (s[n - 5] != 'H') ans++;
if (s[n - 4] != 'A') ans++;
if (s[n - 3] != 'P') ans++;
if (s[n - 2] != 'P') ans++;
if (s[n - 1] != 'Y') ans++;
for (int i = n - 6; i >= 0; i--) {
if (s.substr(i, 5) != "HAPPY") continue;
ans++;
}
cout << ans << endl;
}
int main() {
FASTIO();
int t = 1;
while (t--) {
solve();
}
}
ei13333333