結果
| 問題 | 
                            No.1005 BOT対策
                             | 
                    
| コンテスト | |
| ユーザー | 
                             fukafukatani
                         | 
                    
| 提出日時 | 2020-03-06 21:33:19 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,205 bytes | 
| コンパイル時間 | 11,725 ms | 
| コンパイル使用メモリ | 376,664 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-14 10:24:38 | 
| 合計ジャッジ時間 | 12,791 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 RE * 3 | 
コンパイルメッセージ
warning: function `read_vec` is never used
  --> src/main.rs:45:4
   |
45 | fn read_vec<T: std::str::FromStr>() -> Vec<T> {
   |    ^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
            
            ソースコード
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}
fn main() {
    let mut s = read::<String>().chars().collect::<Vec<_>>();
    let t = read::<String>().chars().collect::<Vec<_>>();
    if t.len() == 1 {
        if s.iter().any(|&ch| ch == t[0]) {
            println!("-1");
            return;
        }
        println!("0");
        return;
    }
    let mut ans = 0;
    for i in 0..s.len() + 1 - t.len() {
        if (0..t.len()).all(|j| t[j] == s[i + j]) {
            ans += 1;
            s[i + t.len() - 2] = '.';
        }
    }
    println!("{}", ans);
}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
            
            
            
        
            
fukafukatani