当前位置:网站首页>(digital statistics dp+good) acwing 338 Counting problem
(digital statistics dp+good) acwing 338 Counting problem
2022-06-11 23:35:00 【Age worry】
338. Counting problem
Topic link https://www.acwing.com/problem/content/340/
subject :

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
int get_ct(int u){
int ct=0;
while(u){
ct++;
u/=10;
}
return ct;
}
int get(int u,int id){
int ct=get_ct(u);
int res=0;
for(int j=1;j<=ct;j++){
int k=pow(10,j-1);
int r=u%k;
int l=u/k/10;
int temp=u/k%10;
if(id) res+=l*k;
if(!id&&l) res+=(l-1)*k;
if(id==temp&&(id||l))
res+=r+1;
if(id<temp&&(id||l))
res+=k;
}
return res;
}
int main(){
int a,b;
while(cin>>a>>b){
if(!a&&!b) break;
if(a>b) swap(a,b);
for(int i=0;i<10;i++){
printf("%d ",get(b,i)-get(a-1,i));
}
printf("\n");
}
return 0;
}
边栏推荐
- 2022年高处安装、维护、拆除操作证考试题库模拟考试平台操作
- Beginner JS BOM implementation window centered
- CD流程
- Top selling commodities 【 project mall 】
- GMN of AI medicine article interpretation
- PHP mkdir(): permission denied uploading a file will change the folder permission to 411 permission
- 移印工艺流程及应用注意事项
- 2022高压电工考试题模拟考试题库及在线模拟考试
- [day13-14 intensive literature reading] cross dimensional magnetic interactions arise from memory interference
- [Delphi] determine the encoding method of the file (ANSI, Unicode, utf8, unicodebig)
猜你喜欢

One to one correspondence of multiple schematic diagrams and PCB diagrams under Altium designer project

I2C read / write process
![[day6-7 intensive literature reading] a unifying Bayesian framework accounting for spatiotemporal interactions with a](/img/a9/c0f3a6b76d789d47172727d353d9be.png)
[day6-7 intensive literature reading] a unifying Bayesian framework accounting for spatiotemporal interactions with a

CVPR 2022 | meta learning performance in image regression task
![Vs code writing assembly code [microcomputer principle]](/img/fc/e32262fcd80841ba7b82882a89ad0b.png)
Vs code writing assembly code [microcomputer principle]
![Display product details [project mall]](/img/51/1ead9d9dde9bca6a9acea9667328ac.png)
Display product details [project mall]

Lake Shore - supertran VP continuous flow cryogenic thermostat system

A method of relay for ultra long distance wireless transmission of low power wireless module

Jetpack架构组件学习(3)——Activity Results API使用

Read the logstash principle
随机推荐
Beginner JS BOM implementation window centered
思科私有动态路由协议:EIGRP
[day4 literature intensive reading] space – time interdependence: evidence against Asymmetric mapping between time and space
Dblink operation in Oracle
mysql——find_ in_ Set usage
In order to stimulate inspiration and creativity, Shanghai daoning united with XMIND to bring you full-featured mind mapping and brainstorming software
[Delphi] determine the encoding method of the file (ANSI, Unicode, utf8, unicodebig)
mysql——find_in_set用法
Introduction aux bases de SOLR
Lake Shore - supervaritemp low temperature thermostat
抗原產品進入家庭,中國醫療器械企業迎來新藍海
一文读懂Logstash原理
2022 safety officer-b certificate theoretical question bank and simulation test
El scrollbar display horizontal scroll bar
Cisco private dynamic routing protocol: EIGRP
直播预告|FeatureStore Meetup V3 重磅来袭!
[day1/5 literature intensive reading] speed constancy or only slowness: what drives the kappa effect
My creation anniversary
Vs code writing assembly code [microcomputer principle]
Altium designer工程下多个原理图和PCB图的一一对应