#include<bits/stdc++.h>
using namespace std ;
#define mid (r+l)/2
#define fr(i,n) for(int i=0;i<n;i++)
typedef long long ll ;
ll ans=0 ;
int main()
{
int t ;
cin >> t ;
while(t--)
{
ll r , l ;
cin >> l >> r ;
for(int i=l;i<=r;i++)
{
ll x=i ;
while(x>0)
{
ans+=x%10;
x/=10 ;
}
}
cout<<ans<<endl;
ans=0 ;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
3 |
Execution timed out |
1085 ms |
212 KB |
Time limit exceeded |
4 |
Execution timed out |
1086 ms |
280 KB |
Time limit exceeded |
5 |
Execution timed out |
1060 ms |
212 KB |
Time limit exceeded |