제출 #1227654

#제출 시각아이디문제언어결과실행 시간메모리
1227654thesenTrol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define vint vector <int>
#define vll vector <ll>
#define vbool vector<bool>
#define pairint pair<int,int>
#define pairll pair<ll,ll>
#define fi first
#define sc second
#define rever greater<ll>()
using namespace std;

void solve(ll tc){
    ll l, r; cin >> l >> r; l--;
    ll x = l%9 + 1;
    l = (l/9 * 45) + x * (x-1) / 2;
    x = r%9 + 1;
    r = (r/9 * 45) + x * (x-1) / 2;
    cout << r - l << endl;
}

int main(){
    ll t; cin >> t;
    for(int i = 1; i <= t; i++){
        solve(i);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...