結果

問題 No.3455 N-beatsu
コンテスト
ユーザー Ping Chung Chang
提出日時 2026-04-03 23:17:46
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,218 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,700 ms
コンパイル使用メモリ 188,676 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-03 23:18:37
合計ジャッジ時間 4,546 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::fmt::Debug;
use std::io::{self, Read};
use std::str::{FromStr, SplitWhitespace};

struct IoContent {
    s: String,
}
impl IoContent {
    fn new() -> IoContent {
        let mut s = String::new();
        let _ = io::stdin().read_to_string(&mut s);
        IoContent { s: s }
    }
}

struct IoReader<'a> {
    inp: SplitWhitespace<'a>,
}

impl IoReader<'_> {
    fn new<'a>(inp: &'a IoContent) -> IoReader<'a> {
        IoReader {
            inp: inp.s.split_whitespace(),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        <T as FromStr>::Err: Debug,
    {
        self.inp.next().unwrap().parse::<T>().unwrap()
    }
}

fn solve(inp: &mut IoReader, n: u64) -> String {
    let x: u64 = inp.read();
    let s = n.to_string();
    let sx = x.to_string();
    if sx.find(&s) != None || x % n == 0{
        return "Yes".into();
    }
    else {
        return "No".into();
    }
}

fn main() {
    let inp = IoContent::new();
    let mut inp = IoReader::new(&inp);
    let n: u64 = inp.read();
    let q: usize = inp.read();
    let mut ans = String::new();
    for _ in 0..q {
        ans += &solve(&mut inp, n);
        ans += "\n";
    }
    print!("{ans}");
}
0