제출 #976952

#제출 시각아이디문제언어결과실행 시간메모리
976952vjudge1Trol (COCI19_trol)C++17
0 / 50
1050 ms348 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int num(int n){
    if (n < 9)
        return n;
    if (n % 9 == 0)
        return n % 9 + 1;
    return n % 9;
}

int f(int a, int b){
    int result = 0;
    for (int i = a; i <= b; i++)
        result += num(i);
    return result;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while(t--){
        int a, b; cin >> a >> b;
        cout << f(a, b) << endl;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...