36012023-03-01 09:46:26Error42Decimáliacpp17Runtime error 30/10024ms6788 KiB
#include <iostream>
#include <vector>

using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int a;
    cin >> a;
    int cur = 0;
    string s = "";
    int lposIndex = a-1;
    vector<int> curs;
    for (size_t i = 0; i < a; i++)
    {
        curs.push_back(cur);
        cur/=10;
        int b;
        cin >> b;
        cur+=b;
        //cout << cur << "\n";
    }
    int tV = 1;
    if(cur==0) {
        return -1;
        for (size_t i = 0; i < curs.size(); i++)
        {
            if(curs[i]!=0) {
                lposIndex = i-1;
                cur = curs[i];
            }
        }
        if(lposIndex==(a-1)) {
            cout << 0 << "\n";
            return 0;
        }
        
    }
    for (size_t i = 0; i < 18; i++)
    {
        tV*=10;
        if(tV>cur) {
            cur=cur-(cur%(tV/10));
            break;
        }
    }
    for (size_t i = 0; i < lposIndex; i++)
    {
        s+='0';
    }
    cout << cur << s << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Accepted3ms2060 KiB
3Accepted3ms2284 KiB
subtask20/25
4Runtime error3ms2376 KiB
5Runtime error3ms2604 KiB
6Runtime error3ms2652 KiB
7Runtime error2ms2768 KiB
8Runtime error3ms2968 KiB
subtask30/26
9Runtime error3ms3328 KiB
10Runtime error3ms3452 KiB
11Runtime error3ms3552 KiB
12Runtime error3ms3792 KiB
13Runtime error3ms3764 KiB
14Accepted3ms3804 KiB
15Accepted3ms3932 KiB
16Accepted3ms4152 KiB
subtask40/19
17Accepted3ms4528 KiB
18Wrong answer3ms4476 KiB
19Accepted3ms4472 KiB
20Accepted3ms4456 KiB
subtask530/30
21Accepted24ms6508 KiB
22Accepted24ms6472 KiB
23Accepted24ms6728 KiB
24Accepted24ms6684 KiB
25Accepted24ms6684 KiB
26Accepted24ms6772 KiB
27Accepted17ms6788 KiB
28Accepted3ms4896 KiB