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