fork(2) download
  1. #include <vector>
  2. #include <string>
  3. #include <iostream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {
  11. int n;
  12. cin >> n;
  13. if (n%4)
  14. {
  15. cout << "prime\n";
  16. return 0;
  17. }
  18. int two = 0;
  19. while(n%2 == 0)
  20. {
  21. two++;
  22. n /= 2;
  23. }
  24. vector<int> ps;
  25. for(int d = 3; n > 1 && d*d <= n; d+=2)
  26. {
  27. while(n%d == 0)
  28. {
  29. ps.push_back(d);
  30. n /= d;
  31. }
  32. }
  33. if (n > 1) ps.push_back(n);
  34. if (ps.size() <= 1)
  35. {
  36. cout << "single\n";
  37. for(int i = 0; i < two-1; ++i) cout << "2 ";
  38. cout << (ps.size()==0 ? 2 : 2*ps[0]) << endl;
  39. }
  40. else
  41. {
  42. cout << "many\n";
  43. for(int i = 0; i < two-2; ++i) cout << "2 ";
  44. cout << 2*ps[0] << " ";
  45. n = 1;
  46. for(int i = 1; i < ps.size(); ++i) n *= ps[i];
  47. cout << 2*n << endl;
  48. for(int i = 0; i < two-1; ++i) cout << "2 ";
  49. cout << 2*n*ps[0] << endl;
  50. }
  51. }
  52.  
  53.  
  54.  
Success #stdin #stdout 0s 4568KB
stdin
84
stdout
many
6 14
2 42