标签:
4
样例输出
3
测试代码
1 #include<stdio.h> 2 3 int main() 4 { 5 int n, i, unit, decade, hundred, kilo, count = 0; 6 scanf("%d", &n); 7 for(i = 0; i < n; i++) 8 { 9 unit = i % 10; 10 decade = i / 10 % 10; 11 hundred = i / 100 % 10; 12 kilo = i / 1000; 13 if(unit <= 2 && decade <= 2 && hundred <= 2 && kilo <= 2) 14 { 15 count++; 16 } 17 } 18 printf("%d\n", count); 19 return 0; 20 }
3
标签:
原文地址:http://www.cnblogs.com/maxin/p/5512348.html