제출 #1259590

#제출 시각아이디문제언어결과실행 시간메모리
1259590mguuuhTrol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define ll long long
vector<ll> deret = {0, 1, 3, 6, 10, 15, 21, 28, 36, 45};

ll f(ll x){
    return (x / 9) * 45 + deret[x % 9];
}

int main(){
    ll q; cin >> q;
    for(ll i = 1; i <= q; i++){
        ll l, r; cin >> l >> r;
        cout << f(r) - f(l - 1) << endl;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...