# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
971203 |
2024-04-28T06:36:15 Z |
vjudge1 |
Trol (COCI19_trol) |
C++ |
|
1000 ms |
404 KB |
#include <bits/stdc++.h>
using namespace std;
int sumDigits(int num) {
int sum = 0;
while (num > 0) {
sum += num % 10;
num /= 10;
}
if(sum>9){
return sumDigits(sum);
}else{
return sum;
}
}
int main(){
int q;
cin>>q;
while (q--)
{
long long l,r;
cin>>l>>r;
int ans=0;
for (int i = l; i <=r; i++)
{
ans+=sumDigits(i);
}
cout<<ans<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Execution timed out |
1091 ms |
404 KB |
Time limit exceeded |
5 |
Execution timed out |
1043 ms |
344 KB |
Time limit exceeded |