#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
ll l,r;
ll solve(ll x){
if(x>10){
x=(x-10)%9+1;
return x;
}
else {
return x;
}
}
// if x>10
// x%10 + x/10
// 29490
// 303
// 33
// 6
// 11 13
// 24
// 6
// 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1(19) 2(20) 3 4 5 6 7 8 9 1(28) 2 3 4 5 6 7 8 9 1(37)
// b=9
// (x-10)%9;
// x=x+solve(i)
// i>n
// 721476
// 7 2 1
int main()
{
ios
ll n; cin >> n;
while (n--){
cin >> l >> r;
ll cnt=0;
for (int i=l; i<=r; i++){
cnt=cnt+ solve(i);
}
cout << cnt << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
1089 ms |
348 KB |
Time limit exceeded |
4 |
Execution timed out |
1074 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
1060 ms |
348 KB |
Time limit exceeded |