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

查看30道真题和解析