結果

問題 No.2051 Divide
コンテスト
ユーザー ixTL255
提出日時 2023-02-16 23:11:11
言語 Rust
(1.97.1 + proconio + num + itertools + ACL)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 2,000 ms
+ 807µs
コード長 644 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11,142 ms
コンパイル使用メモリ 182,116 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-17 18:09:39
合計ジャッジ時間 11,920 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn divisors (n: usize) -> Vec<usize> {
    let mut res: Vec<usize> = Vec::new();

    for i in 1..=n {
        if i * i > n { break; }
        if n % i == 0 {
            res.push(i);
            if n / i > i {
                res.push(n / i);
            }
        }
    }
    res.sort();
    res
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();

    let res = divisors(a);

    println!("{}", res.iter().filter(|x| *x % b == 0).count());
}
0