結果

問題 No.1005 BOT対策
ユーザー MaboyMaboy
提出日時 2021-06-28 20:25:01
言語 Swift
(5.10.0)
結果
RE  
実行時間 -
コード長 399 bytes
コンパイル時間 7,307 ms
コンパイル使用メモリ 151,664 KB
実行使用メモリ 14,748 KB
最終ジャッジ日時 2023-09-07 21:25:09
合計ジャッジ時間 10,079 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
14,340 KB
testcase_01 AC 6 ms
14,120 KB
testcase_02 AC 6 ms
14,360 KB
testcase_03 AC 7 ms
13,784 KB
testcase_04 AC 6 ms
13,804 KB
testcase_05 AC 7 ms
14,188 KB
testcase_06 AC 6 ms
13,912 KB
testcase_07 AC 6 ms
13,852 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 6 ms
13,804 KB
testcase_11 AC 7 ms
14,168 KB
testcase_12 AC 16 ms
14,332 KB
testcase_13 AC 7 ms
13,784 KB
testcase_14 AC 10 ms
14,748 KB
testcase_15 AC 7 ms
13,944 KB
testcase_16 AC 8 ms
14,192 KB
testcase_17 AC 7 ms
13,832 KB
testcase_18 RE -
testcase_19 AC 6 ms
13,768 KB
testcase_20 AC 6 ms
13,800 KB
testcase_21 AC 6 ms
13,356 KB
testcase_22 AC 6 ms
13,196 KB
testcase_23 AC 6 ms
13,652 KB
testcase_24 AC 10 ms
14,532 KB
testcase_25 AC 15 ms
14,200 KB
testcase_26 AC 15 ms
14,348 KB
testcase_27 AC 6 ms
14,180 KB
testcase_28 AC 98 ms
14,272 KB
testcase_29 AC 7 ms
14,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation
var s = String(readLine()!)
let t = String(readLine()!)
var c = 0
if t.count == 1 && s.contains(t){
    print(-1)
}else{
    var q = s
    let i = t.index(before: t.endIndex)
    let p = t[...t.index(before: i)] + "." + t[i...]
    while q.contains(t){
        let r = q.range(of: t)!
        q = q.replacingOccurrences(of: t, with: p,range: r)
    }
    print(q.count - s.count)
}
0