Submission #975358

# Submission time Handle Problem Language Result Execution time Memory
975358 2024-05-05T02:57:38 Z vjudge1 Trol (COCI19_trol) C++17
10 / 50
1000 ms 420 KB
#include <iostream>
#define int long long
using namespace std;

signed main() {
    int q;
    cin >> q;

    while (q--) {
        int ans = 0;
        int l, r;
        cin >> l >> r;

        for (int i = l; i <= r; i++) {
            int x = i;
            
            // Hitung penjumlahan digit sampai menjadi 1 digit
            while (x > 10) {
                int sum = 0;
                while (x > 0) {
                    sum += (x % 10);
                    x /= 10;
                }
                x = sum;
            }
            ans += x;
        }
        cout << ans << endl;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Incorrect 3 ms 348 KB Output isn't correct
4 Execution timed out 1094 ms 420 KB Time limit exceeded
5 Execution timed out 1073 ms 348 KB Time limit exceeded