#include <bits/stdc++.h>
#define int long long
using namespace std;
int calc(int n){
int a = n % 9;
return (n / 9) * 35 + ((a * a + a) / 2);
}
int f(int a, int b){
return calc(b) - calc(a - 1);
}
signed main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t; cin >> t;
while(t--){
int a, b; cin >> a >> b;
cout << f(a, b) << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 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 |
348 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |