# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976389 | vjudge1 | Trol (COCI19_trol) | C++17 | 1060 ms | 404 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;
ll sudigi(ll x, ll ret){
if(x < 10){
ret += x;
return ret;
}
return sudigi(x/10, (x%10) + ret);
}
int main(){
ll q; cin >> q;
while(q--){
ll ans = 0;
ll a, b; cin >> a >> b;
for(ll i = a; i <= b; i++){
ll total = i;
while(total > 9){
total = sudigi(total, 0);
}
ans += total;
}
cout << ans << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |