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