#include <iostream>usingnamespacestd;
longlong func(longlong v)
{
longlong result = 0;
longlong a, b;
result += (v / 100) * 10;
a = (v / 10) % 10;
b = v % 10;
if (b >= a)
{
result += a;
}
else
{
result += a - 1;
}
return result;
}
int main()
{
longlong L, R;
while (cin >> L >> R) {
longlong result = func(R) - func(L);
longlong a = (L / 10) % 10;
longlong b = L % 10;
if (a == b)
result++;
cout << result << endl;
}
return0;
}
题目2: 如果一个数字满足以下条件,就称它是奇异数 1、这个数字至少有两位 2、这个数字的最低两位是相同的 计算区间[L,R]内的所有奇异数。参考答案:#include using namespace std;long long func(long long v){ long long result = 0; long long a, b;