#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#define endl "\n"
#define dbg << "," <<
#define int long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define Bound 998244353
using namespace std;
bool comp(char a, char b) {
return (int)a < (int)b;
}
int32_t main()
{
int t;
cin >> t;
while (t--) {
int64_t a, b;
cin >> a >> b;
a--;
int lowSum = (a / 9) * 45 + (1 + a % 9) * (a % 9) / 2;
int highSum = (b / 9) * 45 + (1 + b % 9) * (b % 9) / 2;
cout << highSum - lowSum << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |