# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
971202 |
2024-04-28T06:35:10 Z |
vjudge1 |
Trol (COCI19_trol) |
C++ |
|
1 ms |
348 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 awal=sumDigits(l);
int ans=awal;
int z=awal;
for (int i = 0; i < l-r; i++)
{
if(z==9){
z=awal+1;
}
ans+=z;
z++;
}
cout<<ans<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |