#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;
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Execution timed out |
1091 ms |
204 KB |
Time limit exceeded |
4 |
Execution timed out |
1098 ms |
204 KB |
Time limit exceeded |
5 |
Execution timed out |
1090 ms |
204 KB |
Time limit exceeded |