結果

問題 No.2751 429-like Number
ユーザー 👑 chro_96chro_96
提出日時 2024-05-10 23:06:48
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 956 ms / 4,000 ms
コード長 714 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 30,208 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-10 23:07:23
合計ジャッジ時間 20,358 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 935 ms
6,944 KB
testcase_08 AC 920 ms
6,940 KB
testcase_09 AC 895 ms
6,944 KB
testcase_10 AC 927 ms
6,944 KB
testcase_11 AC 896 ms
6,940 KB
testcase_12 AC 911 ms
6,944 KB
testcase_13 AC 927 ms
6,940 KB
testcase_14 AC 898 ms
6,944 KB
testcase_15 AC 886 ms
6,940 KB
testcase_16 AC 925 ms
6,940 KB
testcase_17 AC 922 ms
6,940 KB
testcase_18 AC 880 ms
6,940 KB
testcase_19 AC 932 ms
6,940 KB
testcase_20 AC 925 ms
6,940 KB
testcase_21 AC 915 ms
6,940 KB
testcase_22 AC 923 ms
6,940 KB
testcase_23 AC 913 ms
6,944 KB
testcase_24 AC 956 ms
6,944 KB
testcase_25 AC 939 ms
6,940 KB
testcase_26 AC 880 ms
6,944 KB
testcase_27 AC 930 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int q = 0;
  long long a = 0LL;
  
  int res = 0;
  
  long long p[100000] = {};
  int pcnt = 0;
  
  int flag[100001] = {};
  
  for (int q = 2; q <= 100000; q++) {
    if (flag[q] <= 0) {
      p[pcnt] = (long long)q;
      pcnt++;
      for (int r = 2; q*r <= 100000; r++) {
        flag[r*q] = 1;
      }
    }
  }
  
  res = scanf("%d", &q);
  while (q > 0) {
    int cnt = 0;
    res = scanf("%lld", &a);
    for (int i = 0; i < pcnt; i++) {
      while (a%p[i] == 0LL) {
        cnt++;
        a /= p[i];
      }
    }
    if ((cnt == 3 && a == 1LL) || (cnt == 2 && a > 1LL)) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
    q--;
  }
  
  return 0;
}
0