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