0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-20 13:25:25 +00:00
OI-codes/Luogu/problem/P4942/P4942.cpp

17 lines
267 B
C++
Raw Normal View History

2021-08-21 12:03:03 +00:00
#include <bits/stdc++.h>
using namespace std;
int t;
long long l, r, c;
int main() {
cin >> t;
while (t--) {
cin >> l >> r;
c = (r - l + 1) % 9;
cout << (c * (l % 9) % 9 + c * (c - 1) % 9 * 5 % 9) % 9 << endl;
}
return 0;
}