# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
221128 | eohomegrownapps | Trol (COCI19_trol) | C++14 | 5 ms | 384 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;
typedef long long ll;
vector<ll> pref;
ll suminc(ll x){
if (x==0){
return 0;
}
return pref[9]*(x/9)+pref[(x%9)];
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
int q;
cin>>q;
pref.resize(10,0);
for (int i = 1; i<=9; i++){
pref[i]=pref[i-1]+i;
}
for (int i = 0; i<q; i++){
ll l,r;
cin>>l>>r;
cout<<(suminc(r)-suminc(l-1))<<'\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |