fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool is_prime(long long n) {
  6. if (n < 2) return false;
  7. for(int i=2;i*i<=n;i++){
  8. if(n%i==0) return false;
  9. }
  10. return true;
  11. }
  12.  
  13. void solve() {
  14. int n;
  15. cin >> n;
  16.  
  17. bool all_prime = true;
  18. for (int i = 0; i < n; ++i) {
  19. long long a;
  20. cin >> a;
  21. if (all_prime && !is_prime(a)) {
  22. all_prime = false;
  23. }
  24. }
  25.  
  26. if (all_prime) {
  27. cout << "Hop le\n";
  28. } else {
  29. cout << "Khong hop le\n";
  30. }
  31. }
  32.  
  33. int main() {
  34. ios_base::sync_with_stdio(false);
  35. cin.tie(NULL);
  36.  
  37. int t;
  38. if (cin >> t) {
  39. while (t--) {
  40. solve();
  41. }
  42. }
  43.  
  44. return 0;
  45. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty