結果

問題 No.1005 BOT対策
ユーザー MaboyMaboy
提出日時 2021-06-28 20:30:40
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 8,404 ms
コンパイル使用メモリ 153,920 KB
実行使用メモリ 14,668 KB
最終ジャッジ日時 2023-09-07 21:31:34
合計ジャッジ時間 10,718 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
14,608 KB
testcase_01 AC 7 ms
13,644 KB
testcase_02 AC 7 ms
14,148 KB
testcase_03 AC 7 ms
13,660 KB
testcase_04 WA -
testcase_05 AC 7 ms
14,140 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 6 ms
13,868 KB
testcase_09 AC 6 ms
14,052 KB
testcase_10 AC 6 ms
14,176 KB
testcase_11 AC 6 ms
14,152 KB
testcase_12 AC 16 ms
14,616 KB
testcase_13 AC 7 ms
14,024 KB
testcase_14 AC 9 ms
14,412 KB
testcase_15 AC 7 ms
14,180 KB
testcase_16 AC 8 ms
13,892 KB
testcase_17 AC 6 ms
13,784 KB
testcase_18 AC 6 ms
14,072 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 6 ms
13,544 KB
testcase_22 AC 6 ms
13,424 KB
testcase_23 AC 6 ms
13,348 KB
testcase_24 AC 11 ms
14,668 KB
testcase_25 AC 14 ms
14,492 KB
testcase_26 AC 13 ms
14,328 KB
testcase_27 WA -
testcase_28 AC 96 ms
14,384 KB
testcase_29 AC 6 ms
14,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation
var s = String(readLine()!)
let t = String(readLine()!)
var q = s
var c = 0
if t.count == 1 && s.contains(t){
    print(-1)
}else if s.contains(t){
    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