fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int jumlah;
  6. cin >> jumlah;
  7.  
  8. for (int a = 0; a < jumlah; a++) {
  9. int angka;
  10. cin >> angka;
  11.  
  12. int total = 0;
  13. for(int b = 1; b <= sqrt(angka); b++) {
  14. if (angka % b == 0) {
  15. if (angka / b == b) {
  16. total++;
  17. } else {
  18. total += 2;
  19. }
  20. }
  21. if (total > 4) break;
  22. }
  23.  
  24. if (total <= 4) {
  25. cout << "YA" << endl;
  26. } else {
  27. cout << "BUKAN" << endl;
  28. }
  29. }
  30. }
  31.  
  32.  
  33.  
  34.  
Success #stdin #stdout 0.01s 5316KB
stdin
7
10
14
9
15
17
51
52
stdout
YA
YA
YA
YA
YA
YA
BUKAN