結果

問題 No.2811 Calculation Within Sequence
コンテスト
ユーザー
提出日時 2024-08-13 13:42:58
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,486 ms
コンパイル使用メモリ 184,312 KB
実行使用メモリ 8,348 KB
最終ジャッジ日時 2026-04-03 21:04:30
合計ジャッジ時間 9,339 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn g() -> Vec<u64> {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	s.split_whitespace().flat_map(str::parse).collect()
}
fn d(a: u64, b: u64) -> u64 {
	if a < 1 {
		return b;
	}
	d(b % a, a)
}
fn main() {
	g();
	let (t, s) = (g(), g());
	let t = t.iter().cloned().reduce(d).unwrap();
	let s = s.iter().all(|s| s % t == 0);
	println!("{}", if s { "Yes" } else { "No" });
}
0