#include <bits/stdc++.h>
using namespace std;
long long Q,L,R;
int main(){
cin>>Q;
for(long long i=1;i<=Q;i++){
cin>>L>>R;
//Cari dari 1-R
long long A = ((R/9)*45)+((R%9)*(R%9+1)/2);
//Cari Selisih/1-L
long long B = (((L-1)/9)*45)+((((L-1)%9)/2)*(((L-1)%9)+1));
cout<<A-B<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |