fork download
  1. #include<iostream>
  2. #include<algorithm>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int t;
  8. long long n;
  9. cin >> t;
  10. int smallest = 10e9;
  11.  
  12. while (t--) {
  13. int gcd_val, lcm;
  14. cin >> n;
  15.  
  16. int times = n / 2;
  17. while (times--) {
  18. int a = 1, b = n - 1;
  19. gcd_val = __gcd(a, b);
  20.  
  21. a++; b--;
  22. lcm = (a * b) / gcd_val;
  23. if (lcm < smallest) { smallest = lcm; }
  24. else { continue; }
  25.  
  26. }
  27. }
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty