#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
//ll N = 1152921504606846976;
//vector<ll> sum(N+1);
/*
void bruteforce(ll n){
for(ll i = 1; i <= n; i++){
ll t = i;
ll m;
while(t > 0){
m = t%10;
sum[i] += m;
t /= 10;
}
}
}
*/
int main(){
//bruteforce(N);
//vector<ll> sum(10);
int q; cin >> q;
while(q--){
ll l, r; cin >> l >> r;
ll ans = 0;
for(ll i = l; i <= r; i++){
ans += (i % 9);
}
cout << ans << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Execution timed out |
1090 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
1036 ms |
344 KB |
Time limit exceeded |