35952023-03-01 09:33:06Error42Decimáliacpp17Wrong answer 56/10023ms6580 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];
            }
        }
        
    }
    for (size_t i = 0; i < lposIndex; i++)
    {
        s+='0';
    }
    cout << cur << s << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Accepted3ms2016 KiB
3Accepted3ms2228 KiB
subtask20/25
4Wrong answer3ms2316 KiB
5Accepted3ms2544 KiB
6Accepted3ms2524 KiB
7Accepted3ms2756 KiB
8Accepted3ms2792 KiB
subtask326/26
9Accepted3ms2984 KiB
10Accepted3ms3056 KiB
11Accepted3ms3292 KiB
12Accepted3ms3392 KiB
13Accepted2ms3480 KiB
14Accepted3ms3592 KiB
15Accepted3ms3560 KiB
16Accepted3ms3696 KiB
subtask40/19
17Accepted3ms4060 KiB
18Wrong answer3ms4012 KiB
19Accepted3ms4016 KiB
20Accepted3ms3912 KiB
subtask530/30
21Accepted23ms6008 KiB
22Accepted23ms6296 KiB
23Accepted23ms6496 KiB
24Accepted23ms6448 KiB
25Accepted23ms6456 KiB
26Accepted23ms6580 KiB
27Accepted16ms6508 KiB
28Accepted3ms4416 KiB