結果

問題 No.1702 count good string
ユーザー harurunharurun
提出日時 2021-09-11 13:45:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 8,572 KB
最終ジャッジ日時 2023-09-30 09:30:11
合計ジャッジ時間 4,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 14 ms
8,028 KB
testcase_02 AC 16 ms
7,916 KB
testcase_03 AC 15 ms
8,004 KB
testcase_04 AC 16 ms
7,964 KB
testcase_05 AC 15 ms
8,036 KB
testcase_06 AC 15 ms
7,988 KB
testcase_07 AC 15 ms
8,088 KB
testcase_08 AC 14 ms
8,004 KB
testcase_09 AC 15 ms
7,988 KB
testcase_10 AC 15 ms
7,980 KB
testcase_11 AC 15 ms
8,048 KB
testcase_12 AC 14 ms
8,064 KB
testcase_13 AC 82 ms
8,572 KB
testcase_14 AC 85 ms
8,448 KB
testcase_15 AC 81 ms
8,544 KB
testcase_16 AC 78 ms
8,404 KB
testcase_17 AC 78 ms
8,456 KB
testcase_18 AC 80 ms
8,492 KB
testcase_19 AC 80 ms
8,284 KB
testcase_20 AC 81 ms
8,544 KB
testcase_21 AC 81 ms
8,456 KB
testcase_22 AC 82 ms
8,400 KB
testcase_23 AC 14 ms
8,048 KB
testcase_24 AC 15 ms
8,124 KB
testcase_25 AC 15 ms
8,044 KB
testcase_26 AC 14 ms
8,100 KB
testcase_27 AC 15 ms
8,036 KB
testcase_28 AC 15 ms
7,972 KB
testcase_29 AC 15 ms
8,152 KB
testcase_30 AC 14 ms
8,064 KB
testcase_31 AC 14 ms
8,028 KB
testcase_32 AC 15 ms
7,912 KB
testcase_33 AC 51 ms
8,480 KB
testcase_34 AC 52 ms
8,484 KB
testcase_35 AC 50 ms
8,516 KB
testcase_36 AC 53 ms
8,512 KB
testcase_37 AC 51 ms
8,432 KB
testcase_38 AC 51 ms
8,508 KB
testcase_39 AC 53 ms
8,456 KB
testcase_40 AC 52 ms
8,308 KB
testcase_41 AC 51 ms
8,316 KB
testcase_42 AC 54 ms
8,376 KB
testcase_43 AC 62 ms
8,444 KB
testcase_44 AC 76 ms
8,352 KB
testcase_45 AC 14 ms
8,068 KB
testcase_46 AC 14 ms
7,912 KB
testcase_47 AC 14 ms
7,968 KB
testcase_48 AC 14 ms
8,068 KB
testcase_49 AC 13 ms
7,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  N=int(input())
  assert(1<=N<=100000)
  S=input()
  for i in S:
    assert(ord("a")<=ord(i)<=ord("z") or i=="?")
  assert(len(S)==N)
  dp=[[0]*2 for __ in range(10)]
  T=set("yukicoder")
  d={"y":0,"u":1,"k":2,"i":3,"c":4,"o":5,"d":6,"e":7,"r":8}
  mod=10**9+7
  for i in range(N):
    if S[i] in T:
      if S[i]=="y":
        dp[0][0]+=1
      else:
        x=d[S[i]]
        dp[x][0]+=dp[x-1][0]
        dp[x][0]%=mod
        dp[x][1]+=dp[x-1][1]
        dp[x][1]%=mod
    elif S[i]=="?":
      dp[0][1]+=1
      for j in range(8):
        dp[j+1][1]+=dp[j][0]
        dp[j+1][1]%=mod
  print((dp[8][0]+dp[8][1])%mod)
  return

main()
0