結果

問題 No.1250 汝は倍数なりや?
ユーザー ixTL255
提出日時 2023-01-12 22:08:59
言語 Rust
(1.83.0 + proconio)
結果
RE  
実行時間 -
コード長 567 bytes
コンパイル時間 11,730 ms
コンパイル使用メモリ 397,364 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-23 14:46:15
合計ジャッジ時間 14,583 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 RE * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();

    let _n: u64 = itr.next().unwrap().parse().unwrap();
    let h: u64 = itr.next().unwrap().parse().unwrap();
    let a: Vec<u64> = itr.map(|x| x.parse().unwrap()).collect();
    
    let mut p = 1;
    let mut ans = "NO".to_string();
    for x in a {
        p *= x;
        p %= h;
        if p == 0 {
            ans = "YES".to_string();
            break;
        }
    }
    
    println!("{}", ans);

}
0