結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2024-05-10 23:06:48 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 993 ms / 4,000 ms |
| コード長 | 714 bytes |
| コンパイル時間 | 315 ms |
| コンパイル使用メモリ | 30,208 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-20 07:17:59 |
| 合計ジャッジ時間 | 22,470 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 22 |
ソースコード
#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;
}
chro_96