結果
問題 | No.442 和と積 |
ユーザー |
![]() |
提出日時 | 2019-04-30 13:34:35 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 24,229 ms |
コンパイル使用メモリ | 382,208 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-29 21:09:50 |
合計ジャッジ時間 | 17,415 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 7 |
ソースコード
fn read<T: std::str::FromStr>() -> Vec<T>where<T as std::str::FromStr>::Err: std::fmt::Debug,{let mut b = String::new();std::io::stdin().read_line(&mut b).unwrap();b.split_whitespace().map(|x| x.trim().parse::<T>().unwrap()).collect()}fn gcd(x: u64, y: u64) -> u64 {let (x, y) = if x < y { (x, y) } else { (y, x) };if x == 0 {return y;}return gcd(x, y % x);}fn main() {let iv = read::<u64>();let a = iv[0];let b = iv[1];let ag = gcd(a + b, a);let bg = gcd(a + b, b);println!("{}", gcd(a + b, ag / gcd(ag, bg) * bg));}