結果
| 問題 |
No.1702 count good string
|
| コンテスト | |
| ユーザー |
sasa8uyauya
|
| 提出日時 | 2024-08-08 20:17:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 324 bytes |
| コンパイル時間 | 531 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 76,184 KB |
| 最終ジャッジ日時 | 2024-08-08 20:18:02 |
| 合計ジャッジ時間 | 4,484 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 47 |
ソースコード
n=int(input())
s=input()
t="yukicoder"
m=len(t)
M=10**9+7
q=[[0]*(m+1),[0]*(m+1)]
q[0][0]=1
for c in s:
for i in reversed(range(m)):
if c==t[i]:
q[0][i+1]+=q[0][i]
q[0][i+1]%=M
q[1][i+1]+=q[1][i]
q[1][i+1]%=M
if c=="?":
q[1][i+1]+=q[0][i]
q[1][i+1]%=M
print((q[0][m]+q[1][m])%M)
sasa8uyauya