# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
871601 | vjudge1 | Trol (COCI19_trol) | C++11 | 1 ms | 348 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;
using ll = long long;
int main(){
int q;
cin >> q;
while(q--) {
ll a, b;
cin >> a >> b ;
a--;
ll temp1 = (a-1)/9;
ll tm = temp1 * 45;
temp1 = max(0ll, (((a-9*temp1)) * ((a-9*temp1)+1)) / 2);
temp1 += tm;
ll temp2 = (b-1)/9;
ll tm2 = temp2 * 45;
temp2 = max(0ll, (((b-9*temp2)) * ((b-9*temp2)+1)) / 2);
temp2 += tm2;
cout << temp2 - temp1 << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |