# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
976704 |
2024-05-07T03:22:52 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1000 ms |
348 KB |
#include <iostream>
#include <vector>
using namespace std;
int digitSum(int x) {
int sum = 0;
while (x > 0) {
sum += x % 10;
x /= 10;
}
if (sum >= 10) {
return digitSum(sum);
}
return sum;
}
int main() {
int q;
cin >> q;
vector<int> answers;
for (int i = 0; i < q; ++i) {
int l, r;
cin >> l >> r;
int sum = 0;
for (int j = l; j <= r; ++j) {
sum += digitSum(j);
}
answers.push_back(sum);
}
for (int ans : answers) {
cout << ans << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Execution timed out |
1076 ms |
348 KB |
Time limit exceeded |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |