97492024-03-06 11:23:51UnluckYDecimáliacpp17Accepted 100/10081ms18204 KiB
#include <bits/stdc++.h>

using namespace std;


#define int long long

signed main(){

    int n; cin >> n;
    vector<int> v; 
    int p = 0;

    for (int i = 1; i <= n; i++){
        int a; cin >> a; 
        a = a + p;
        v.push_back(a%10);
        p = a/10;
    }
    while (p > 0){
        v.push_back(p%10);
        p /= 10;
    }
    


    int x = 0;
    for (int i = v.size()-1; i >= 0; i--){
        if (v[i] != 0){
            x = i;
            break;
        }
    }

    cout << (to_string(v[x]))+string(x, '0') << endl;




/*
    //reverse(v.begin(), v.end());

    int mego = v[n-1]; // lehet 0

    for (int i = n-2; i >= 0; i--){
        //cout << n-i-1 << " " << v[i]/10 << endl;
        if (v[i] / 10 >= n-i-1){
            mego += v[i]/10;
            break;
        }
    }

    

    cout << (to_string(mego))+string(n-1, '0');
*/
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1816 KiB
2Accepted3ms2288 KiB
3Accepted3ms2112 KiB
subtask225/25
4Accepted3ms2300 KiB
5Accepted3ms2544 KiB
6Accepted3ms2784 KiB
7Accepted3ms2964 KiB
8Accepted3ms3092 KiB
subtask326/26
9Accepted3ms3216 KiB
10Accepted3ms3428 KiB
11Accepted3ms3476 KiB
12Accepted3ms3688 KiB
13Accepted3ms3656 KiB
14Accepted3ms3904 KiB
15Accepted3ms3996 KiB
16Accepted3ms4088 KiB
subtask419/19
17Accepted3ms4084 KiB
18Accepted3ms4124 KiB
19Accepted3ms4216 KiB
20Accepted3ms4328 KiB
subtask530/30
21Accepted78ms7976 KiB
22Accepted78ms9624 KiB
23Accepted78ms11484 KiB
24Accepted78ms13324 KiB
25Accepted81ms15160 KiB
26Accepted79ms17000 KiB
27Accepted48ms18204 KiB
28Accepted3ms16204 KiB