WA 了一个点,百思不得其解
#include <iostream>
bool check(int x)
{
while (x % 10 == 9)
x /= 10;
return x % 10 == 2;
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
long long l, r;
std::cin >> l >> r;
if (r - l >= 10)
std::cout << 2 << "\n";
else
{
for (long long i = l; i < r; i++)
if (i % 10 == 2 || check(i))
{
std::cout << 2 << "\n";
return 0;
}
std::cout << 1 << "\n";
}
return 0;
}