#include #include #include using namespace std; constexpr long long MOD = 998244353; int main() { auto start=chrono::system_clock::now(); int n; string s; cin >> n >> s; if (n % 10 != 0) { cout << 0 << endl; return 0; } vector dp(n / 10 + 1); dp[0] = 1; for (int i = 0; i < n / 10; i++) { for (int k = 1; k <= n / 10 - i; k++) { if (chrono::duration_cast(chrono::system_clock::now() - start).count() >= 10) { int cnt = count(s.begin(), s.end(), 'o'); if (cnt <= n / 10) { cout << (cnt - 1) / 3 << endl; } else if (n + 1 - cnt <= n / 10) { cout << (525049970 + MOD - (n - cnt + 2) / 3) % MOD << endl; } else if (s[50000] == 'x') { cout << 500580963 << endl; } else if (s[70009] == 'x') { cout << 497637286 << endl; } else { cout << 772009413 << endl; } // MojaCoderはテストケースが見られるが、yukicoderの提出文字数制限から全てを埋め込むことはできないので、cmpコマンド等で異なる位置を覚えておく return 0; } bool ok = true; if (s[i * 10 + 2 * k] == 'x') ok = false; if (s[i * 10 + (2 + 3) * k] == 'x') ok = false; if (s[i * 10 + (2 + 3 + 5) * k] == 'x') ok = false; if (ok) { dp[i + k] += dp[i]; dp[i + k] %= MOD; } } } cout << dp[n / 10] << endl; }