結果

問題 No.1005 BOT対策
ユーザー natoriusannatoriusan
提出日時 2023-07-30 11:47:03
言語 F#
(F# 4.0)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 618 bytes
コンパイル時間 7,617 ms
コンパイル使用メモリ 192,540 KB
実行使用メモリ 58,096 KB
最終ジャッジ日時 2024-04-17 13:05:33
合計ジャッジ時間 17,418 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 315 ms
34,208 KB
testcase_01 AC 314 ms
34,272 KB
testcase_02 AC 328 ms
34,276 KB
testcase_03 AC 322 ms
34,688 KB
testcase_04 AC 57 ms
29,824 KB
testcase_05 AC 324 ms
34,628 KB
testcase_06 AC 58 ms
29,824 KB
testcase_07 AC 58 ms
29,684 KB
testcase_08 AC 58 ms
29,696 KB
testcase_09 AC 58 ms
29,696 KB
testcase_10 AC 324 ms
34,208 KB
testcase_11 AC 318 ms
34,544 KB
testcase_12 AC 349 ms
40,388 KB
testcase_13 AC 337 ms
36,572 KB
testcase_14 AC 340 ms
37,108 KB
testcase_15 AC 337 ms
36,788 KB
testcase_16 AC 337 ms
36,600 KB
testcase_17 AC 333 ms
34,652 KB
testcase_18 AC 60 ms
29,824 KB
testcase_19 AC 59 ms
29,684 KB
testcase_20 AC 60 ms
29,684 KB
testcase_21 AC 328 ms
34,208 KB
testcase_22 AC 316 ms
34,264 KB
testcase_23 AC 334 ms
34,336 KB
testcase_24 AC 342 ms
38,556 KB
testcase_25 AC 347 ms
39,804 KB
testcase_26 AC 347 ms
39,816 KB
testcase_27 AC 60 ms
29,824 KB
testcase_28 AC 443 ms
58,096 KB
testcase_29 AC 323 ms
34,464 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (272 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let mutable s = stdin.ReadLine ()
let t = stdin.ReadLine ()
let firstLength = s.Length
let length = t.Length

let findIndex (str: string) (search: string) =
    let mutable index = -1
    for i in 0..str.Length-search.Length do
        if index = -1 && str.[i..i+search.Length-1] = search then
            index <- i
    index
    
if length = 1 then
    if s |> Seq.contains t.[0] then
        printfn "-1"
    else
        printfn "0"
else
    while findIndex s t <> -1 do
        let index = findIndex s t
        s <- s.[..index+t.Length-2] + "." + s.[index+t.Length-1..]
    s.Length - firstLength |> printfn "%d"
0