結果

問題 No.136 Yet Another GCD Problem
コンテスト
ユーザー taotao54321
提出日時 2018-10-18 20:28:52
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
WA  
実行時間 -
コード長 701 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 549 ms
コンパイル使用メモリ 184,048 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-07 07:55:17
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#![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