36112023-03-01 10:27:55Error42Decimáliacpp17Accepted 100/10024ms6080 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) {
        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;
        }
        if(i==17 && tV<=cur) {
            cur = cur-(cur%1000000000000000000);
        }
    }
    for (size_t i = 0; i < lposIndex; i++)
    {
        s+='0';
    }
    cout << cur << s << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1848 KiB
2Accepted3ms2052 KiB
3Accepted3ms2288 KiB
subtask225/25
4Accepted2ms2372 KiB
5Accepted3ms2508 KiB
6Accepted3ms2556 KiB
7Accepted3ms2616 KiB
8Accepted3ms2720 KiB
subtask326/26
9Accepted3ms2824 KiB
10Accepted3ms2852 KiB
11Accepted3ms2936 KiB
12Accepted3ms3076 KiB
13Accepted2ms3156 KiB
14Accepted3ms3284 KiB
15Accepted3ms3496 KiB
16Accepted3ms3704 KiB
subtask419/19
17Accepted3ms3812 KiB
18Accepted3ms3896 KiB
19Accepted3ms3896 KiB
20Accepted3ms3816 KiB
subtask530/30
21Accepted24ms6068 KiB
22Accepted24ms5996 KiB
23Accepted23ms6080 KiB
24Accepted24ms6060 KiB
25Accepted24ms5960 KiB
26Accepted23ms5960 KiB
27Accepted16ms5972 KiB
28Accepted3ms4052 KiB