35972023-03-01 09:35:11Error42Decimáliacpp17Wrong answer 81/10024ms5980 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;
    for (size_t i = 0; i < 18; i++)
    {
        tV*=10;
        if(tV>cur) {
            cur=cur-(cur%(tV/10));
            break;
        }
    }
    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 < lposIndex; i++)
    {
        s+='0';
    }
    cout << cur << s << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Accepted3ms2060 KiB
3Accepted3ms2252 KiB
subtask225/25
4Accepted3ms2480 KiB
5Accepted3ms2692 KiB
6Accepted3ms2904 KiB
7Accepted3ms2968 KiB
8Accepted3ms2964 KiB
subtask326/26
9Accepted3ms3188 KiB
10Accepted3ms3284 KiB
11Accepted3ms3304 KiB
12Accepted3ms3384 KiB
13Accepted3ms3504 KiB
14Accepted2ms3584 KiB
15Accepted3ms3952 KiB
16Accepted3ms3852 KiB
subtask40/19
17Accepted3ms4228 KiB
18Wrong answer3ms3864 KiB
19Accepted3ms4008 KiB
20Accepted3ms3872 KiB
subtask530/30
21Accepted24ms5948 KiB
22Accepted24ms5956 KiB
23Accepted24ms5952 KiB
24Accepted24ms5952 KiB
25Accepted24ms5960 KiB
26Accepted24ms5972 KiB
27Accepted16ms5980 KiB
28Accepted3ms3924 KiB