36002023-03-01 09:38:57Error42Decimáliacpp17Wrong answer 81/10024ms6180 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;
        }
    }
    for (size_t i = 0; i < lposIndex; i++)
    {
        s+='0';
    }
    cout << cur << s << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1824 KiB
2Accepted3ms2060 KiB
3Accepted3ms2276 KiB
subtask225/25
4Accepted3ms2440 KiB
5Accepted3ms2652 KiB
6Accepted3ms2868 KiB
7Accepted3ms3080 KiB
8Accepted3ms3176 KiB
subtask326/26
9Accepted3ms3304 KiB
10Accepted2ms3420 KiB
11Accepted3ms3544 KiB
12Accepted3ms3620 KiB
13Accepted3ms3624 KiB
14Accepted3ms3852 KiB
15Accepted3ms3912 KiB
16Accepted3ms3856 KiB
subtask40/19
17Accepted3ms3876 KiB
18Wrong answer3ms3852 KiB
19Accepted3ms3776 KiB
20Accepted3ms3780 KiB
subtask530/30
21Accepted24ms5876 KiB
22Accepted24ms5780 KiB
23Accepted24ms5912 KiB
24Accepted24ms5912 KiB
25Accepted24ms5864 KiB
26Accepted24ms6112 KiB
27Accepted16ms6180 KiB
28Accepted3ms4044 KiB