# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
485658 | tato | Trol (COCI19_trol) | C++14 | 1090 ms | 268 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 ll long long
using namespace std;
ll back(ll a)
{
ll cnt=0;
while(a>0)
{
cnt+=(a%10);
a=a/10;
}
if(cnt>9)
return back(cnt);
else
return cnt;
}
int main()
{
int t;
cin>>t;
while(t--)
{
ll l,r;
cin>>l>>r;
ll cnt=0;
for(int k=l; k<=r; k++)
cnt+=back(k);
cout<<cnt<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |