結果

問題 No.2721 "Don't say N" Game
ユーザー bluemeganebluemegane
提出日時 2024-04-12 22:41:36
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 8,878 ms
コンパイル使用メモリ 168,900 KB
実行使用メモリ 184,988 KB
最終ジャッジ日時 2024-04-12 22:41:49
合計ジャッジ時間 9,216 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
29,052 KB
testcase_01 AC 52 ms
29,056 KB
testcase_02 AC 52 ms
28,672 KB
testcase_03 AC 52 ms
28,928 KB
testcase_04 AC 50 ms
29,056 KB
testcase_05 AC 51 ms
184,988 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (94 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var T = int.Parse(Console.ReadLine().Trim());
        while (T-- > 0)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            Console.WriteLine(getDiv(n) % 2 == 0 ? "K" : "P");
        }
    }
    static int getDiv(int n)
    {
        var ans = 0;
        for (int i = 1; i * i <= n; i++)
        {
            if (n % i == 0)
            {
                ans++;
                if (n != i * i) ans++;
            }
        }
        return ans;
    }
}
0