36022023-03-01 09:50:29Error42Decimáliacpp17Wrong answer 81/10024ms6408 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
1Accepted3ms1980 KiB
2Accepted3ms2100 KiB
3Accepted3ms2244 KiB
subtask225/25
4Accepted3ms2472 KiB
5Accepted3ms2684 KiB
6Accepted3ms2876 KiB
7Accepted3ms3220 KiB
8Accepted3ms3340 KiB
subtask326/26
9Accepted3ms3596 KiB
10Accepted3ms3676 KiB
11Accepted3ms3880 KiB
12Accepted3ms3988 KiB
13Accepted3ms4116 KiB
14Accepted3ms4236 KiB
15Accepted3ms4244 KiB
16Accepted3ms4204 KiB
subtask40/19
17Accepted3ms4208 KiB
18Wrong answer3ms4204 KiB
19Accepted3ms4204 KiB
20Accepted3ms4112 KiB
subtask530/30
21Accepted24ms6132 KiB
22Accepted24ms6260 KiB
23Accepted24ms6404 KiB
24Accepted24ms6408 KiB
25Accepted24ms6240 KiB
26Accepted23ms6360 KiB
27Accepted16ms6360 KiB
28Accepted3ms4196 KiB