fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. const int N = 503;
  5. char s[N][N] = {};
  6. long long lcm(int a, int b)
  7. {
  8. return a * b / __gcd(a, b);
  9. }
  10. int main()
  11. {
  12. cin.tie(0)->sync_with_stdio(0);cout.tie(0);
  13. int n = 5;
  14. for (int i = 1; i <= n; i ++)
  15. {
  16. for (int j= 1; j <= n; j ++)
  17. {
  18. if (lcm(i, j) / __gcd(i, j) <= 3)cout<<i<<" "<<j<<endl;
  19. }
  20. }
  21. }
  22.  
Success #stdin #stdout 0.01s 5476KB
stdin
Standard input is empty
stdout
1 1
1 2
1 3
2 1
2 2
2 4
3 1
3 3
4 2
4 4
5 5