fork download
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. ios::sync_with_stdio(false);
  8. cin.tie(nullptr);
  9.  
  10. long long N;
  11. ifstream fin("input.txt");
  12. istream* in = &cin;
  13. if (fin) in = &fin;
  14.  
  15. if (!(*in >> N)) return 0; // нет входных данных
  16.  
  17. long long p = 0;
  18. if (N % 2 == 0) {
  19. p = 2;
  20. }
  21. else {
  22. for (long long i = 3; i <= N / i; i += 2) {
  23. if (N % i == 0) { p = i; break; }
  24. }
  25. }
  26.  
  27. ofstream fout("output.txt");
  28. ostream* out = &cout;
  29. if (fout) out = &fout;
  30.  
  31. if (p == 0) {
  32. // N — простое
  33. *out << 1 << " " << (N - 1) << "\n";
  34. }
  35. else {
  36. long long A = N / p;
  37. *out << A << " " << (N - A) << "\n";
  38. }
  39.  
  40. return 0;
  41. }
  42.  
  43.  
Success #stdin #stdout 0.01s 5320KB
stdin
3317541323
stdout
89663279 3227878044