# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974669 |
2024-05-03T15:31:42 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1000 ms |
348 KB |
#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Execution timed out |
1033 ms |
344 KB |
Time limit exceeded |
5 |
Execution timed out |
1041 ms |
348 KB |
Time limit exceeded |