0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 18:52:02 +00:00

P4942 小凯的数字

R56613060
This commit is contained in:
Baoshuo Ren 2021-08-21 20:03:03 +08:00 committed by Baoshuo Ren
parent f593a4176c
commit bbaeaa0472
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,16 @@
#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;
}