diff --git a/Luogu/problem/P4942/P4942.cpp b/Luogu/problem/P4942/P4942.cpp new file mode 100644 index 00000000..34fd3b5d --- /dev/null +++ b/Luogu/problem/P4942/P4942.cpp @@ -0,0 +1,16 @@ +#include + +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; +}