0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 10:31:58 +00:00
OI-codes/Luogu/P4942/P4942.cpp

17 lines
267 B
C++

#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;
}