結果

問題 No.1005 BOT対策
ユーザー cra77756176
提出日時 2022-12-23 19:19:57
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 13,589 ms
コンパイル使用メモリ 403,364 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 01:40:59
合計ジャッジ時間 14,839 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<&str> = xx.split_whitespace().collect();

    let (mut s, t) = (xx[0], xx[1]);

    if t.len() == 1 {
        if s.contains(t) {
            println!("-1");
        } else {
            println!("0");
        }
    } else {
        let mut n = 0;
        while let Some(i) = s.find(t) {
            s = &s[i + t.len() - 1..];
            n += 1;
        }

        println!("{n}");
    }
}
0