結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2023-02-09 04:55:33 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| コード長 | 358 bytes |
| コンパイル時間 | 172 ms |
| コンパイル使用メモリ | 8,100 KB |
| 実行使用メモリ | 12,928 KB |
| 最終ジャッジ日時 | 2025-06-20 01:41:35 |
| 合計ジャッジ時間 | 4,353 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
Main.rb:8: warning: ambiguous first argument; put parentheses or a space even after `-` operator Main.rb:1: warning: assigned but unused variable - rr Syntax OK
ソースコード
rr=Array.new(1003,0)
s=gets.chomp
t=gets.chomp
if t.size==1 then
if s.match(t)==nil then
puts 0
else
puts -1
end
else
n=s.size
m=t.size
as=[]
0.upto(n-m){|p1|
if s[p1,m]==t then
as<<[p1,p1+m-2]
end
}
ans=0
while as.size>0 do
ans2=ans+1
pr=as[0][1]
while as.size>0 && as[0][0]<=pr do
as.shift
ans=ans2
end
end
puts ans
end
horiesiniti