173302025-06-27 20:45:0142thebestestDecimáliacpp17Accepted 100/10025ms3320 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    if (!(cin >> N)) return 0;

    vector<long long> cnt(N + 20, 0);          // +20 biztonsági puffer a hordozóknak
    for (int i = 0; i < N; ++i) cin >> cnt[i];

    // 1. hordozás
    for (size_t i = 0; i + 1 < cnt.size(); ++i) {
        cnt[i + 1] += cnt[i] / 10;   // tízesbe átvivő
        cnt[i] %= 10;                // maradék 0–9
    }

    // 2. legmagasabb nem nulla jegy keresése
    int idx = -1;
    for (int i = (int)cnt.size() - 1; i >= 0; --i)
        if (cnt[i]) { idx = i; break; }

    if (idx == -1) {                 // minden nulla → 0
        cout << 0 << '\n';
        return 0;
    }

    // 3. eredmény kiírása
    cout << cnt[idx];
    for (int i = 0; i < idx; ++i) cout << '0';
    cout << '\n';
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Accepted1ms500 KiB
3Accepted1ms316 KiB
subtask225/25
4Accepted1ms316 KiB
5Accepted1ms316 KiB
6Accepted1ms316 KiB
7Accepted1ms388 KiB
8Accepted1ms316 KiB
subtask326/26
9Accepted1ms500 KiB
10Accepted1ms500 KiB
11Accepted1ms316 KiB
12Accepted1ms316 KiB
13Accepted1ms316 KiB
14Accepted1ms316 KiB
15Accepted1ms316 KiB
16Accepted1ms508 KiB
subtask419/19
17Accepted1ms316 KiB
18Accepted1ms528 KiB
19Accepted1ms500 KiB
20Accepted1ms316 KiB
subtask530/30
21Accepted25ms3108 KiB
22Accepted25ms2980 KiB
23Accepted25ms2980 KiB
24Accepted25ms2984 KiB
25Accepted25ms3320 KiB
26Accepted25ms3104 KiB
27Accepted16ms2136 KiB
28Accepted1ms316 KiB