結果
問題 | No.1702 count good string |
ユーザー |
👑 |
提出日時 | 2022-03-23 09:21:03 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 189 ms / 2,000 ms |
コード長 | 698 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 06:49:42 |
合計ジャッジ時間 | 5,066 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 47 |
ソースコード
local mod = 1000000007local function badd(x, y) return (x + y) % mod endlocal tgtall = {"yukicoder","?ukicoder","y?kicoder","yu?icoder","yuk?coder","yuki?oder","yukic?der","yukico?er","yukicod?r","yukicode?"}local ret = 0local function solve(n, s, tgt)local t = {}for i = 1, 9 dot[i] = 0endfor i = 1, n dofor j = 1, 9 doif s:sub(i, i) == tgt:sub(j, j) thenif j == 1 thent[j] = t[j] + 1elset[j] = badd(t[j], t[j - 1])endendendendret = badd(ret, t[9])endlocal n = io.read("*n", "*l")local s = io.read()for i = 1, #tgtall dosolve(n, s, tgtall[i])endprint(ret)