Submission #975991

# Submission time Handle Problem Language Result Execution time Memory
975991 2024-05-06T04:47:04 Z vjudge1 Trol (COCI19_trol) C++17
20 / 50
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
#define in long long

int bil (int n){
    while(n>=10){
        int hasil=0;
        while (n>0){
            hasil+= n%10;
            n/=10;
        }
        n= hasil;
    }
    return n;
}

int main(){
    in q;
    cin >> q;
    for (int i=0; i<q; i++){
        in l, r;
        in sum=0;
        cin >> l >> r;
        for (int j=l; j<=r; j++){
            sum+= bil(j);
        }
        cout << sum << endl;
    }
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Execution timed out 1046 ms 600 KB Time limit exceeded
5 Execution timed out 1058 ms 348 KB Time limit exceeded