Submission #976866

# Submission time Handle Problem Language Result Execution time Memory
976866 2024-05-07T08:14:20 Z vjudge1 Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    int q;
    cin >> q;
    int a[] = {0, 1, 3, 6, 10, 15, 21, 28, 36, 45};
    while(q--){
        int l, r;
        cin >> l >> r;

        int kanan = (r / 9 * 45) + a[r%9];
        l--;
        int kiri = (l / 9 * 45) + a[l%9];

        cout << kanan - kiri << endl; 
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct