Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: samsenpisardmoo26
Problemset: J.Nine Khanaphat
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-10 15:37:06
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, m;
cin >> n >> m;
long long cnt=0;
for(long long i=1; i<=m; i*=10)
{
long long suf = m/(i*10);
long long curr = (m/i)%10;
long long pre = m%i;
if(curr < 9) cnt += suf*i;
else cnt += suf*i+pre+1;
}
long long cnt2=0;
for(long long i=1; i<n; i*=10)
{
long long suf = (n-1)/(i*10);
long long curr = ((n-1)/i)%10;
long long pre = (n-1)%i;
if(curr < 9) cnt2 += suf*i;
else cnt2 += suf*i+pre+1;
}
cout << cnt-cnt2;
}