#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int T;
cin>>T;
while(T--){
ll l, r;
cin >> l >> r;
ll sum = 0;
while(l<=r && (l%9)!=1){
ll x = l%9;
if(x==0) x = 9;
sum+=x;
l++;
}
while(r>=l ){
sum+=(r%9);
r--;
}
if(r-l+1>0){
ll len=(r-l+1)/9;
sum+=(len*45);
}
cout << sum << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
4 |
Execution timed out |
1080 ms |
212 KB |
Time limit exceeded |
5 |
Execution timed out |
1078 ms |
212 KB |
Time limit exceeded |