# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
250584 | REALITYNB | Trol (COCI19_trol) | C++14 | 1096 ms | 376 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>
#define endl '\n'
using namespace std ;
int countt(int x ){
int sum = 0 ;
while(x){
sum += x%10 ;
x/=10 ;
}
if(sum<10) return sum ;
return countt(sum) ;
}
int main(){
int q ;
cin>> q ;
while(q--){
int l ,r ;
cin>>l>>r ;
int sum = 0 ;
for(int i=l;i<=r;i++){
sum += countt(i) ;
}
cout << sum << endl ;
}
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |