# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975622 | vjudge1 | Trol (COCI19_trol) | C++17 | 1 ms | 352 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>
using namespace std;
#define ll long long
int main(){
ll q; cin >> q;
while(q--){
ll l , r; cin >> l >> r;
ll tot1 = r/9, sisa1 = r%9;
ll sum1 = tot1 * 45 + ((sisa1*(sisa1+1))/2);
l--;
ll tot2 = l/9, sisa2 = l%9;
ll sum2 = tot2 * 45 + ((sisa2*(sisa2+1))/2);
cout << sum1-sum2 << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |