#include<bits/stdc++.h>
using namespace std;
#define bismillah ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#define int long long
signed main(){
bismillah
int q;
cin >> q;
int l, r;
for(int i=0; i<q; i++){
cin >> l >> r;
int ans=0;
for(int j=l; j<=r; j++){
if(j%9==0){
ans+=9;
continue;
}
ans += j%9;
}
cout << ans << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
1089 ms |
456 KB |
Time limit exceeded |
5 |
Execution timed out |
1063 ms |
348 KB |
Time limit exceeded |