# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974882 |
2024-05-04T05:39:31 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1000 ms |
348 KB |
#include <bits/stdc++.h>
#define ld long double
using namespace std;
ld r, l;
ld change(ld k)
{
long double sum = k;
while (sum >= 10)
{
long double tempSum = 0.0;
string sumStr = to_string(sum);
for (char digit : sumStr)
{
if (isdigit(digit))
{
tempSum += (digit - '0');
}
}
sum = tempSum;
}
return sum;
}
void solve()
{
cin >> r >> l;
ld ans = 0;
for (ld i = r; i <= l; i++)
{
ans += change(i);
}
cout << fixed << setprecision(0);
cout << ans << '\n';
}
int main()
{
int t = 1;
cin >> t;
while (t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
37 ms |
348 KB |
Output is correct |
3 |
Correct |
55 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
1061 ms |
348 KB |
Time limit exceeded |
5 |
Execution timed out |
1077 ms |
348 KB |
Time limit exceeded |