답안 #976862

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976862 2024-05-07T08:07:00 Z vjudge1 Trol (COCI19_trol) C++17
30 / 50
1000 ms 428 KB
#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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Execution timed out 1053 ms 428 KB Time limit exceeded
5 Execution timed out 1016 ms 344 KB Time limit exceeded