题解 | #[NOIP2010]数字统计#
[NOIP2010]数字统计
https://www.nowcoder.com/practice/179d9754eeaf48a1b9a49dc1d438525a
#include <stdio.h> int judge( int i) { int a ,count=0; while(i) { a= i%10; i = i/10; if(a==2) { count++; } } return count; } int main() { int L,R,count=0; scanf("%d %d",&L,&R); for(int i=L;i<=R;i++) { int ret = judge(i); count+=ret; } printf("%d",count); return 0; }