답안 #975640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975640 2024-05-05T15:21:54 Z vjudge1 Trol (COCI19_trol) C++17
10 / 50
4 ms 2396 KB
#include <iostream>
#include <vector>

using namespace std;

int digitSum(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum > 9 ? digitSum(sum) : sum;
}

int main() {
    int Q;
    cin >> Q;

    vector<int> bowls(260260);
    for (int i = 1; i <= 260260; i++) {
        bowls[i - 1] = digitSum(i);
    }

    for (int q = 0; q < Q; q++) {
        int L, R;
        cin >> L >> R;

        int sum = 0;
        for (int i = L - 1; i < R; i++) {
            sum += bowls[i];
        }

        cout << sum << endl;
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1624 KB Output is correct
2 Runtime error 4 ms 2396 KB Execution killed with signal 11
3 Incorrect 3 ms 1372 KB Output isn't correct
4 Runtime error 4 ms 2396 KB Execution killed with signal 11
5 Incorrect 3 ms 1372 KB Output isn't correct