mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-12 17:26:26 +00:00
17 lines
267 B
C++
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;
|
||
|
}
|