# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027014 | HasanV11010238 | Trol (COCI19_trol) | C++17 | 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;
#define ll long long
ll su(ll x){
ll ret = 45 * (x / 9);
ll val = x % 9;
ret += val * (val + 1) / 2;
return ret;
}
int main(){
ll q, a, b;
cin>>q;
while (q--){
cin>>a>>b;
cout<<su(b) - su(a - 1)<<"\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |