結果

問題 No.136 Yet Another GCD Problem
ユーザー taotao54321
提出日時 2018-10-18 20:28:52
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 13,543 ms
コンパイル使用メモリ 385,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-07 00:49:03
合計ジャッジ時間 15,199 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(non_snake_case)]

use std::cmp;
use std::io::{ self, prelude::* };

macro_rules! pick {
    ($tokens:expr) => {
        $tokens.next().unwrap().parse().expect("parse error")
    }
}

fn main() {
    let mut s = String::new();
    io::stdin().read_to_string(&mut s).expect("i/o error");
    let mut tokens = s.split_whitespace();

    let N: i64 = pick!(tokens);
    let K: i64 = pick!(tokens);

    let mut ans = 1;
    for d in 2.. {
        if d*d > N { break };

        if N%d == 0 {
            if N/d >= K {
                ans = cmp::max(ans, d);
            }
            if d >= K {
                ans = cmp::max(ans, N/d);
            }
        }
    }

    println!("{}", ans);
}
0