fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. vector<int> checks = {2, 3, 5, 7, 4, 9, 25, 49};
  10. int divisor_count = 0;
  11. string response;
  12.  
  13. for (int num : checks) {
  14. cout << num << endl;
  15. fflush(stdout);
  16. cin >> response;
  17. if (response == "yes") {
  18. divisor_count++;
  19. }
  20. if (divisor_count >= 2) {
  21. cout << "composite" << endl;
  22. fflush(stdout);
  23. return 0;
  24. }
  25. }
  26.  
  27. cout << "prime" << endl;
  28. fflush(stdout);
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
2
3
5
7
4
9
25
49
prime