#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 != 0 && r > l) {
ans += r%9;
r--;
}
ans += 45 * (r-l+1)/9;
cout << ans << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |