# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
977378 |
2024-05-07T20:14:35 Z |
vjudge1 |
Trol (COCI19_trol) |
C++11 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
int sum_of_digits(int n) {
int sum = 0;
while (n > 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
int main() {
vector<int> baskom(61);
for (int i = 1; i <= 60; ++i) {
baskom[i] = i;
}
int Q;
cin >> Q;
for (int i = 0; i < Q; ++i) {
int L, R;
cin >> L >> R;
int total_sum = 0;
for (int j = L; j <= R; ++j) {
int current_num = baskom[j];
while (current_num > 9) {
current_num = sum_of_digits(current_num);
}
total_sum += current_num;
}
cout << total_sum << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |