# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1256795 | horizons | Trol (COCI19_trol) | C++20 | 1093 ms | 412 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int divide(int n){
if (n < 10) return n;
int temp = 0;
while (n > 0){
int ones = n % 10;
temp += ones;
n /= 10;
}
return divide(temp);
}
int main(){
int q; cin >> q;
while (q--){
int l,r; cin >> l >> r;
ll total = 0;
for(int i = l; i <= r;i++){
int a = i;
if (a >= 10) a = divide(a);
total += a;
}
cout << total << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |