# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1252938 | marda | Trol (COCI19_trol) | C++20 | 0 ms | 0 KiB |
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <tuple>
#define endl "\n"
#define int long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define Bound 1001
using namespace std;
int32_t main()
{
int t;
cin >> t;
while (t--) {
int a, b;
cin >> a >> b;
int firstNum = (a - 1) % 9 + 1;
int secondNum = (b - 1) % 9 + 1;
int difference = b - a + 1;
int totalTo9_1st = (10 - firstNum) * (9 + firstNum) / 2;
int totalTo9_2nd = (secondNum) * (1 + secondNum) / 2;
int dfrc = ceil((float)b / 9) - ceil((float)a / 9) - 1;
cout << totalTo9_1st + totalTo9_2nd + dfrc * 45 << endl;
}
return 0;
}