#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;
int convert( ull x) {
int sum = 0;
while( x >= 1) {
int temp = x % 10;
sum+= temp;
x/=10;
}
return sum % 9;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int q; cin >> q;
while( q--) {
ull l,r, sum = 0; cin >> l >> r;
for( ull i = l; i <= r; i++) {
int y = convert(i);
// cout << y << ' ';
sum+=y;
}
cout << sum << "\n";
}
//cout << convert(2024);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
Execution timed out |
1056 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
1004 ms |
348 KB |
Time limit exceeded |