| 记录编号 | 203571 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 984.[NOIP 2010PJ]数字统计 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.003 s | ||
| 提交时间 | 2015-11-03 11:34:55 | 内存使用 | 0.36 MiB | ||
#include<cstdio>
using namespace std;
int two[10001]={0,0,1,0,0,0,0,0,0,0};
int before[10001]={0,0,1,1,1,1,1,1,1,1};
int main(){
freopen("twoj.in","r",stdin);
freopen("twoj.out","w",stdout);
for(int i = 10;i<10001;++i){
two[i] = two[i/10];
if(i%10==2){
two[i]++;
}
before[i] = before[i-1] + two[i];
}
int l,r;
scanf("%d %d",&l,&r);
printf("%d",before[r]-before[l]+two[l]);
fclose(stdin);fclose(stdout);
return 0;
}