当前位置:网站首页>(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;
}
边栏推荐
- 双向带头循环链表(C语言)
- 2022年低压电工上岗证题目及在线模拟考试
- Jetpack架构组件学习(3)——Activity Results API使用
- MySQL 8.0 解压版安装教程
- sonarqube介绍和安装步骤
- Introduction aux bases de SOLR
- Handwritten simple promise
- El select drop-down box style combined with El table (pseudo) combined with drop-down selection
- [day6-7 intensive literature reading] a unifying Bayesian framework accounting for spatiotemporal interactions with a
- Solve the problem of slow downloading plug-ins for idea
猜你喜欢

2022年安全员-A证考题模拟考试平台操作
![[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry](/img/c2/e70e7c32c5dc5554dea29cb4627644.png)
[Day8 literature extensive reading] space and time in the child's mind: evidence for a cross dimensional symmetry

Two ways of using reuqests in RF
![Display product details [project mall]](/img/51/1ead9d9dde9bca6a9acea9667328ac.png)
Display product details [project mall]

Discrete mathematics attention points, priority problems

Procédures d'introduction et d'installation de sonarqube

2022 operation of simulation examination platform for safety officer C certificate

2022高压电工考试题模拟考试题库及在线模拟考试

2022 safety officer-a certificate test question simulation test platform operation

Lake Shore VNF 系列低温恒温器系统——流动蒸汽中的样品
随机推荐
What are the pitfalls of redis's current network: using a cache and paying for disk failures?
2022年起重机司机(限桥式起重机)考试题模拟考试题库及模拟考试
Jenkins basic configuration
Jetpack architecture component learning (3) -- activity results API usage
El select drop-down box style combined with El table (pseudo) combined with drop-down selection
sonarqube介绍和安装步骤
What is bom? And knowledge points
Analysis on the market prospect of smart home based on ZigBee protocol wireless module
CD流程
mysql——find_in_set用法
Leetcode must review 20 lintcode (5466421166978227)
Unity3d C # development of wechat games audio / sound playback problem solving process sharing
Processus postgresql10
HMS core shows the latest open capabilities in mwc2022, helping developers build high-quality applications
VS code 编写汇编代码【微机原理】
Altium designer工程下多个原理图和PCB图的一一对应
Top selling commodities 【 project mall 】
[day4 literature intensive reading] space – time interdependence: evidence against Asymmetric mapping between time and space
On the knowledge points of cookie attributes and the differences between webstorage and cookies?
唤醒手腕 - 神经网络与深度学习(Tensorflow应用)更新中