FNOI_TEST_1 a(模拟)
来源:互联网 发布:新倩女幽魂辅助软件 编辑:程序博客网 时间:2024/06/05 14:08
连模拟都写不对了。。。太弱了。。。
#include <cstdio>#include <cstring>#include <cmath>#define ll long longll l,r;ll solve(ll x){//f[1]+...+f[x] ll res=0;int n=log10(x)+1,a[11]; for(ll i=1,base=1;i<=n;++i,base*=10){//枚举第i位 a[i]=x%(base*10)/base; for(ll j=1;j<=9;++j){//枚举第i位的数字j的贡献 ll tmp=x/(base*10)*base; if(j==a[i]) tmp+=x%base+1; if(j<a[i]) tmp+=base; res+=j*tmp; } } return res;}int main(){ freopen("a.in","r",stdin); freopen("a.out","w",stdout); scanf("%I64d%I64d",&l,&r); printf("%I64d\n",solve(r)-solve(l-1)); return 0;}
阅读全文
0 0
- FNOI_TEST_1 a(模拟)
- FNOI_TEST_1 c(二分)
- FNOI_TEST_1 b(高精度除法)
- A. 拼音魔法(模拟)
- CodeForces 349A Cinema Line (模拟)
- HDU-#4737 A Bit Fun(模拟)
- codeforces-#465A. inc ARG(模拟)
- Codeforces 2A-Winner(模拟)
- codeforces-#475A. Bayan Bus(模拟)
- Codeforces 363A Soroban(算盘模拟)
- Codeforces 363A Soroban(算盘模拟)
- CodeForces 2A - Winner(模拟)
- Codeforces 2A. Winner(字符串:模拟)
- Good Bye 2014 A.(模拟)
- wyh2000 and a string problem(模拟)
- Codeforces 569 A. Music ( 模拟 )
- hdu4716 A Computer Graphics Problem(模拟)
- CodeForces - 545A Toy Cars (模拟)
- react-redux-webpack-express开发环境搭建
- 如何让自己的电脑更快点
- 编程之美
- ToolBar 使用姿势
- JavaEE Servlet发送文件给前端
- FNOI_TEST_1 a(模拟)
- Zend Studio 12.5.1 x86 x64 通用(Mac\Windows)破解补丁和注册码
- 第四篇:基本数据结构——队列的顺序表示
- [编程题]跳台阶和变态跳台阶
- python作业第二周
- linux, 使用vprintf,va_list函数封装一个具有printf功能的函数
- 树状数组
- 第五篇:基本数据结构——线性表的链式表示
- ajax同后台交互demo