| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1315640 | Jawad_Akbar_JJ | Trol (COCI19_trol) | C++20 | 1 ms | 332 KiB |
#include <iostream>
using namespace std;
#define int long long
int solve(int n, int ans = 0){
while (n % 9){
int A = n, B;
while (A > 9){
B = A, A = 0;
while (B)
A += B % 10, B /= 10;
}
ans += A, n--;
}
return ans + n * 5;
}
signed main(){
int t, l, r;
cin>>t;
while (t--){
cin>>l>>r;
cout<<solve(r) - solve(l - 1)<<'\n';
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
