Submission #976627

# Submission time Handle Problem Language Result Execution time Memory
976627 2024-05-06T22:24:35 Z vjudge1 Trol (COCI19_trol) C++17
30 / 50
1000 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int Q;
    cin >> Q;
    while(Q--)
    {
        long long count=0;
        long long L, R;
        cin >> L >> R;
        for (long long i = L; i<=R; i++)
        {
            int hasil = 0;
            if (i < 10)
            {
                hasil = i;
            }
            else if (i % 9 == 0) 
            {
                hasil = 9;
            }
            else
            {
                hasil = (i % 9);
            }
            count += hasil;
        }
        cout << count << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Execution timed out 1067 ms 348 KB Time limit exceeded
5 Execution timed out 1055 ms 348 KB Time limit exceeded