using namespace std;
int main()
{
int m,a,b,x,y,z,k;
int arr[100] = {0};
cin >> m;
for (int i = 0;i < m; i++)
{
k = 0;
cin >> a >> b;
if (a > 0 && a < b && b < 500)
{
for (int j = a;j <= b; j++)
{
x = j % 10;
y = (j / 10) % 10;
z = ((j / 10) / 10) % 10;
if (j < 10)
{
arr[k] = j;
k++;
}
else if ((j >= 10) & (j < 100))
{
if (x == y)
{
arr[k] = j;
k++;
}
}
else if ((j >= 100) & (j < 500))
{
if (x == z)
{
arr[k] = j;
k++;
}
}
j++;
}
for (int t = 0;t < k; t++)
{
cout << arr[t];
if (t < k - 1)
cout << " ";
}
if (k > 0)
cout << endl;
else if (k == 0)
cout << "0" << endl;
}
}
return 0;
}
沒有留言:
張貼留言