Submission #837259

# Submission time Handle Problem Language Result Execution time Memory
837259 2023-08-25T08:44:19 Z LinkedArray Trol (COCI19_trol) C++17
0 / 50
1 ms 304 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    long long q, l, r, d, repeating, cif, sum;

    cin >> q;
    while(q--){
        cin >> l >> r;

        sum = 0;
        repeating = (r - l + 1) / 9;

        cif = (l - 1 + 9) % 9 + 1;
        if(cif != 1){
            sum = 45 - ((cif - 1) * cif / 2); 
        }

        sum += 45 * repeating;

        cif = (r - 1 + 9) % 9 + 1;
        if(cif != 9){
            sum += cif * (cif + 1) / 2;
        }

        cout << sum << '\n';
    }


    return 0;
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:5:24: warning: unused variable 'd' [-Wunused-variable]
    5 |     long long q, l, r, d, repeating, cif, sum;
      |                        ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 1 ms 304 KB Output isn't correct
5 Incorrect 1 ms 212 KB Output isn't correct