Submission #973432

# Submission time Handle Problem Language Result Execution time Memory
973432 2024-05-02T02:04:18 Z vjudge1 Trol (COCI19_trol) C++17
20 / 50
1000 ms 600 KB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int q;
    cin >> q;

    while (q--)
    {
        int l, r;
        cin >> l >> r;
        int start = l % 9;
        if (start == 0)
            start = 9;
        int end = r - l + start;
        ll ans = 0;
        for (int i = start; i <= end; i++)
        {
            int cur = i % 9;
            if (cur == 0)
            {
                cur = 9;
            }
            ans += cur;
        }
        cout << ans << endl;
    }

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