結果

問題 No.1702 count good string
ユーザー O2MTO2MT
提出日時 2021-10-08 22:46:15
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 184,572 KB
最終ジャッジ日時 2023-09-30 11:53:24
合計ジャッジ時間 11,567 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,560 KB
testcase_01 AC 70 ms
71,348 KB
testcase_02 AC 69 ms
71,448 KB
testcase_03 AC 74 ms
75,156 KB
testcase_04 AC 74 ms
75,276 KB
testcase_05 AC 74 ms
75,084 KB
testcase_06 AC 73 ms
75,268 KB
testcase_07 AC 75 ms
75,112 KB
testcase_08 AC 73 ms
75,544 KB
testcase_09 AC 74 ms
75,156 KB
testcase_10 AC 73 ms
75,272 KB
testcase_11 AC 74 ms
75,092 KB
testcase_12 AC 75 ms
75,196 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 332 ms
184,196 KB
testcase_17 AC 340 ms
184,312 KB
testcase_18 AC 339 ms
184,416 KB
testcase_19 WA -
testcase_20 AC 331 ms
184,156 KB
testcase_21 AC 328 ms
184,196 KB
testcase_22 AC 329 ms
184,268 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 320 ms
184,264 KB
testcase_44 AC 334 ms
184,336 KB
testcase_45 AC 71 ms
71,452 KB
testcase_46 AC 72 ms
71,240 KB
testcase_47 AC 72 ms
71,488 KB
testcase_48 AC 71 ms
71,376 KB
testcase_49 AC 70 ms
71,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(str(input()))
MOD = 10**9+7
alp = list(' yukicoder')
dp = [[[0,0] for _ in range(11)] for _ in range(N+1)]
dp[0][0][0] = 1

for i in range(1,N+1):
  s = S[i-1]
  for j in range(10):
    dp[i][j][0] = dp[i-1][j][0]
    dp[i][j][1] = dp[i-1][j][1]
  if s != '?':
    for k in range(10):
      if s == alp[k]:
        j = k
        break
    dp[i][j][0] += dp[i-1][j-1][0]
    dp[i][j][0] %= MOD
    dp[i][j][1] += dp[i-1][j-1][1]
    dp[i][j][1] %= MOD
  else:
    for k in range(1,10):
      dp[i][k][1] += dp[i][k-1][0]
      dp[i][k][1] %= MOD

print(dp[N][9][0]+dp[N][9][1])
0