# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974669 | vjudge1 | Trol (COCI19_trol) | C++17 | 1041 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cmath>
using namespace std;
// Fungsi untuk menghitung jumlah digit dari suatu bilangan
int hitungJumlahDigit(long long n) {
int sum = 0;
while (n > 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
int main() {
int Q;
cin >> Q;
for (int i = 0; i < Q; ++i) {
long long L, R;
cin >> L >> R;
long long total = 0;
// Menghitung jumlah digit dari setiap bilangan dalam rentang
for (long long j = L; j <= R; ++j) {
total += hitungJumlahDigit(j);
}
cout << total << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |