# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028800 | 0pt1mus23 | Trol (COCI19_trol) | C++14 | 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.
#pragma GCC optimize("O3", "inline")
#define skillissue <bits/stdc++.h>
#define ultra_mal std
#include skillissue
using namespace ultra_mal;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ins insert
#define pb push_back
#define int long long int
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl; return;
#define all(x) x.begin(),x.end()
#define hash FhashF
const int mod = 1e9 +7, sze = 1E3 +100, inf = LLONG_MAX, P = 1453;
// const int L = 30;
void cave(){
int l,r;
cin>>l>>r;
int sum=0;
int lx = l;
int rx =r;
while(lx>9){
int s =0;
while(lx){
s+=lx%10;
lx/=10;
}
lx=s;
}
while(rx>9){
int s =0;
while(rx){
s+=rx%10;
rx/=10;
}
rx=s;
}
// cout<<lx<<" "<<rx<<endl;
while(lx<=9 && l<=r){
sum+=lx;
l++;
lx++;
}
while(rx>=1 && r>=l){
sum+=rx;
r--;
rx--;
}
// cout<<l<<" "<<r<<endl;
int v = ((r-l +1)/9) * 45;
sum+=v;
drop(sum);
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int tt = 1;
cin>>tt;
while(tt--){
cave();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |