結果
問題 |
No.1702 count good string
|
ユーザー |
![]() |
提出日時 | 2021-10-09 01:58:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 760 bytes |
コンパイル時間 | 176 ms |
コンパイル使用メモリ | 31,872 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-07-23 11:16:34 |
合計ジャッジ時間 | 1,839 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 41 |
ソースコード
/* -*- coding: utf-8 -*- * * 1702.cc: No.1702 count good string - yukicoder */ #include<cstdio> using namespace std; /* constant */ const int MAX_N = 100000; const int L = 9; const char t[] = "yukicoder"; const int MOD = 1000000007; /* typedef */ typedef long long ll; /* global variables */ char s[MAX_N + 4]; int dp[MAX_N + 1][L + 1]; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } /* main */ int main() { int n; scanf("%d%s", &n, s); dp[0][0] = 1; for (int i = 0; i < n; i++) for (int j = 0; j <= L; j++) if (dp[i][j] > 0) { addmod(dp[i + 1][j], dp[i][j]); if (j < L && (s[i] == '?' || s[i] == t[j])) addmod(dp[i + 1][j + 1], dp[i][j]); } printf("%d\n", dp[n][L]); return 0; }