結果

問題 No.2721 "Don't say N" Game
ユーザー powellpowell
提出日時 2024-04-12 21:56:26
言語 Rust
(1.77.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,217 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 163,464 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-12 21:56:27
合計ジャッジ時間 1,071 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 3 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]

use proconio::{
    input,
    marker::{Bytes, Chars, Usize1},
};

macro_rules! debug {
    ( $($val:expr),* $(,)* ) => {{
        #[cfg(debug_assertions)]
        eprintln!( concat!($(stringify!($val), " = {:?}, "),*), $($val),* );
    }};
}

macro_rules! debug2D {
    ( $array:expr ) => {{
        #![cfg(debug_assertions)]
        eprintln!("{}: ", stringify!($array));
        for row in &$array {
            eprintln!("{:?}", row);
        }
    }};
}

// constant
const MOD1: usize = 1_000_000_007;
const MOD9: usize = 998_244_353;
const INF: usize = 1001001001001001001;

fn main() {
    input! {
        T: usize,
    }

    for _ in 0..T {
        solve();
    }
}

fn solve() {
    input! {
        N: usize,
    }

    // Nの正の約数の個数をカウント
    let mut cnt = 0;

    let mut i = 1;
    while i * i <= N {
        if i * i == N {
            cnt += 1;
        } else if N % i == 0 {
            cnt += 2;
        }
        i += 1;
    }

    // 偶奇で場合分け
    if cnt % 2 == 0 {
        println!("K");
    } else {
        println!("P");
    }
}
0