洛谷题目 P1980
有点难度,想了半个小时了{:10_277:}// https://www.luogu.com.cn/problem/P1980
#include <iostream>
using namespace std;
int main()
{
int n, x, i, r = 0, a;
cin >> n >> x;
for (i = 1; i <= n; i++)
{
a = i;
while (a)
{
if (a % 10 == x)
r++;
a /= 10;
}
}
cout << r;
return 0;
}
页:
[1]