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