#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define all(a) a.begin(), a.end()
int main() {
fast
int A[] = {0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9};
ll q, l, r;
cin>>q;
rep(i, q){
cin>>l>>r;
int start_num = l%9;
ll multiple = (r-l+1)/9;
ll mod = (r-l+1)%9;
ll ans = 45*multiple;
for(int j = start_num, k = 0 ; k < mod ; k++, j++){
ans+=A[j];
}
cout<<ans<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |