#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <cctype>
#include <sstream>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#define sf scanf
#define pf printf
#define sfint scanf ("%d %d",&a,&b)
#define sfl scanf ("%ld %ld",&a,&b)
#define sfll scanf ("%lld %lld",&a,&b)
#define sfd scanf ("%lf %lf",&a,&b)
#define sff scanf ("%f %f",&a,&b)
#define loop(i,n) for(i=0;i<n;i++)
#define LL long long
#define L long
#define nl puts("")
#define MX 1000005
#define N 100
#define MOD 10000000007
#define pb push_back
#define pi acos(-1.0)
#define sz size()
#define gc getchar ()
#define ps push
#define clr clear
#define bn begin()
#define ed end()
using namespace std;
/*int sumofDigit(int N)
{
if(N<10)
return N*(N+1)/2;
int n=N,i;
while(n/10!=0)
{
i++;
n/=10;
}
int p=pow(10,i);
return ((n*i*45*p/10)+(n*(n-1)*p/2)+n*(N%p+1)+sumofDigit(N%p));
}*/
LL digit(LL n)
{
if (n<10) return n*(n+1)/2;
LL take=n,i=0;
while(n/10 != 0)
{
i++;
n/=10;
}
-
return ((n*i*45*p/10) + (n*(n-1)*p/2) + n*(take%p+1) + digit(take%p));
}
int main()
{
-
while(t--)
{
-
cout << digit
(y
) - digit
(x-
1); nl;
}
return 0;
}
-
Comments
Post a Comment