#include <iostream>
using namespace std;
bool checkPair(int a, int b)
{
int res;
while(1)
{
if (a >= b)
return false;
res = a*2 - b;
if (res == 0)
return true;
else if (res < 0)
return false;
else
a = res;
}
}
int main()
{
for (int i = 1; i <= 1000; i++)
{
for (int j = 1; j <= 1000; j++)
if (checkPair(i, j))
cout << i << ' ' << j << std::endl;
}
return 0;
}
Comments