题解 | #[NOIP2010]数字统计#
[NOIP2010]数字统计
https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a
#include <stdio.h> int main() { int L, R, count = 0; scanf("%d %d", &L, &R); for (int i = L; i <= R; i++) { int temp = i; while (temp) { if (temp % 10 == 2) { count++; } temp /= 10; } } printf("%d", count); return 0; }
c语言刷题 文章被收录于专栏
c语言刷题题目