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