NOIP2010数字统计

2013年11月6日5,2103

题目描述

请统计某个给定范围[L, R]的所有整数中,数字2 出现的次数。
比如给定范围[2, 22],数字2 在数2 中出现了1 次,在数12 中出现1 次,在数20 中出现1 次,在数21 中出现1 次,在数22 中出现2 次,所以数字2 在该范围内一共出现了6次。
「输入输出样例1」
two.in
two.out
2 22
6
「输入输出样例2」
two.in
two.out
2 100
20

输入

输入文件名为two.in。
输入共1 行,为两个正整数L 和R,之间用一个空格隔开。

输出

输出文件名为two.out。
输出共1 行,表示数字2 出现的次数。

提示

1 ≤ L ≤ R≤ 10000。

代码

 

avatar
3 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
shehhhshemoo吴鸿宇 Recent comment authors
  Subscribe  
提醒
shehhh
shehhh

这个错了!有错误!

shemoo
shemoo

黄学长可能忘了10000里有一个1,特判一下就好了吧?

吴鸿宇
吴鸿宇

这个程序有错误