# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975137 | vjudge1 | Trol (COCI19_trol) | C++17 | 1 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int q; cin >> q;
while(q--){
ll l, r; cin >> l >> r;
ll ansR = 0;
ansR += (r/9) * 45;
for(int i = 1; i <= r % 9; i++){
ansR += i;
}
ll ansL = 0;
ansL += ((l-1)/9) * 45;
for(int i = 1; i <= (l-1) % 9; i++){
ansL += i;
}
cout << ansR - ansL << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |