結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
Mr.Fuku
|
| 提出日時 | 2020-07-14 13:21:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 303 bytes |
| コンパイル時間 | 146 ms |
| コンパイル使用メモリ | 8,064 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2025-06-20 00:53:37 |
| 合計ジャッジ時間 | 4,075 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-` operator Syntax OK
ソースコード
def is_impossible(s, t)
return false if t.size > 1
s.include?(t)
end
s = gets.chomp
t = gets.chomp
if is_impossible(s, t)
puts -1
return
end
cnt = 0
t_len = t.size
while true do
idx = s.index(t)
break if idx.nil?
s = s[idx+t_len-1...]
cnt += 1
end
puts cnt
Mr.Fuku