Submission #975998

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

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

int main(){
    int q;
    cin >> q;
    for (int i=0; i<q; i++){
        long long l, r;
        long long 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 348 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 1087 ms 404 KB Time limit exceeded
5 Execution timed out 1055 ms 348 KB Time limit exceeded