結果
| 問題 |
No.430 文字列検索
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2016-10-03 00:51:45 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 862 ms / 2,000 ms |
| コード長 | 220 bytes |
| コンパイル時間 | 59 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,672 KB |
| 最終ジャッジ日時 | 2024-11-10 00:07:34 |
| 合計ジャッジ時間 | 7,863 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
コンパイルメッセージ
Main.rb:11: warning: assigned but unused variable - m Syntax OK
ソースコード
def f(base, token)
i = cnt = 0
while i = base.index(token, i)
i += 1
cnt += 1
end
cnt
end
base = gets.chomp
m = gets.to_i
tokens = $<.map(&:chomp)
p tokens.reduce(0){|sum, token| sum + f(base, token)}
neko_the_shadow