제출 #976862

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

int sederhana(int n){
    while (n / 10){
        n = n / 10 + n % 10;
    }
    return n;
}

int f(int n1, int n2){
    int answer = 0;
    for (int i = n1; i <= n2; i++){
        answer += sederhana(i);
    }
    return answer;
}

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