Submission #974691

# Submission time Handle Problem Language Result Execution time Memory
974691 2024-05-03T16:05:09 Z vjudge1 Trol (COCI19_trol) C++14
10 / 50
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;

int q;
int pref[30], arr[30];

int get_range(int a, int b){
    int l = (a - 1) % 9 + 1;
    int r = (b - 1) % 9 + 1;

    return pref[r] - pref[l-1] + 45 * ((b - a) / 9); 
}


int main(){
    cin >> q;

    pref[0] = 0; 
    for (int i = 0; i < 30; i++){
        arr[i] = (i - 1) % 9 + 1; 
        pref[i] = arr[i] +  pref[i-1];
    }

    for (int i = 0; i < q; i++)
    {
        int l,r;
        cin >> l >> r;
        cout << get_range(l,r) << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct