結果

問題 No.1113 二つの整数 / Two Integers
コンテスト
ユーザー ikd
提出日時 2020-07-18 17:25:13
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 528 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 542 ms
コンパイル使用メモリ 196,064 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-24 11:36:40
合計ジャッジ時間 1,669 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn gcd(a: i64, b: i64) -> i64 {
    if a % b == 0 {
        b
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).ok();
    let ab: Vec<i64> = line
        .trim()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
    let (a, b) = (ab[0], ab[1]);
    let g = gcd(a, b);
    let sqrt = (g as f64).sqrt();
    if sqrt.ceil() == sqrt.floor() {
        println!("Odd");
    } else {
        println!("Even");
    }
}
0