結果

問題 No.1005 BOT対策
ユーザー natoriusan
提出日時 2023-07-30 11:44:32
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 8,369 ms
コンパイル使用メモリ 184,488 KB
実行使用メモリ 58,172 KB
最終ジャッジ日時 2024-10-09 07:03:11
合計ジャッジ時間 17,735 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 10 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (231 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
    printfn "-1"
else
    while findIndex s t <> -1 do
        let index = findIndex s t
        s <- s.[..index+t.Length-2] + "." + s.[index+t.Length-1..]
        printfn "%s" s
    s.Length - firstLength |> printfn "%d"
0