結果

問題 No.2721 "Don't say N" Game
コンテスト
ユーザー chro_96
提出日時 2024-04-12 22:12:28
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 365 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 393 ms
コンパイル使用メモリ 38,208 KB
最終ジャッジ日時 2026-02-22 11:39:36
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main () {
  int t = 0;
  int n = 0;
  
  int res = 0;
  
  res = scanf("%d", &t);
  while (t > 0) {
    int cnt = 0;
    res = scanf("%d", &n);
    for (int p = 1; p*p <= n; p++) {
      if (p*p == n) {
        cnt++;
      }
    }
    if (cnt > 0) {
      printf("K\n");
    } else {
      printf("P\n");
    }
    t--;
  }
  
  return 0;
}
0