#include <bits/stdc++.h>
using namespace std;
#define debug cout << "here\n";
int main()
{
int q; cin >> q;
while(q--){
long long ans = 0;
int l,r; cin >> l >> r;
while(l%9 != 1 && l <= r) {
if(l%9 == 0) {
ans += 9;
}else
ans += l%9;
l++;
}
while(r%9 != 9 && r > l) {
ans += l%9;
l++;
}
ans += 45 * (r-l+1)/9;
cout << ans << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
4 |
Execution timed out |
1063 ms |
348 KB |
Time limit exceeded |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |