题解 | #[NOIP2013]记数问题#
[NOIP2013]记数问题
https://www.nowcoder.com/practice/28b2d9f2bf2c48de94a1297ed90e1732
#include <stdio.h>
int main()
{
int n = 0;
int x = 0;
int count = 0;
scanf("%d %d", &n, &x);
while(n)
{
int tmp = n;
while(tmp)
{
if(tmp % 10 == x)
{
count++;
}
tmp/=10;
}
n--;
}
printf("%d\n", count);
return 0;
}

查看24道真题和解析