Submission
Status:
PPPP------
Score: 40
User: akuyga1
Problemset: J.Nine Khanaphat
Language: c
Time: 0.001 second
Submitted On: 2024-10-15 09:42:27
#include <stdio.h>
#include <math.h>
long long int count(int x){
long long int temp=x;
long long int count=0;
int N=0;
while(x!=0){
if(x%10<9){count+=(x%10)*N*pow(10,N-1);x/=10;}
else {
count+=(9)*N*pow(10,N-1);
count+=temp-(x*pow(10,N))+1;
x/=10;
}
N++;
}
return count;
}
int main() {
//for each 10^n you find that there is n*20^(n-1) each num
long long int x,y;
scanf("%lld %lld",&x,&y);
printf("%lld",count(y)-count(x-1));
return 0;
}