#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) {
return -1;
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";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
3 | Accepted | 3ms | 2284 KiB | ||||
subtask2 | 0/25 | ||||||
4 | Runtime error | 3ms | 2376 KiB | ||||
5 | Runtime error | 3ms | 2604 KiB | ||||
6 | Runtime error | 3ms | 2652 KiB | ||||
7 | Runtime error | 2ms | 2768 KiB | ||||
8 | Runtime error | 3ms | 2968 KiB | ||||
subtask3 | 0/26 | ||||||
9 | Runtime error | 3ms | 3328 KiB | ||||
10 | Runtime error | 3ms | 3452 KiB | ||||
11 | Runtime error | 3ms | 3552 KiB | ||||
12 | Runtime error | 3ms | 3792 KiB | ||||
13 | Runtime error | 3ms | 3764 KiB | ||||
14 | Accepted | 3ms | 3804 KiB | ||||
15 | Accepted | 3ms | 3932 KiB | ||||
16 | Accepted | 3ms | 4152 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Accepted | 3ms | 4528 KiB | ||||
18 | Wrong answer | 3ms | 4476 KiB | ||||
19 | Accepted | 3ms | 4472 KiB | ||||
20 | Accepted | 3ms | 4456 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 24ms | 6508 KiB | ||||
22 | Accepted | 24ms | 6472 KiB | ||||
23 | Accepted | 24ms | 6728 KiB | ||||
24 | Accepted | 24ms | 6684 KiB | ||||
25 | Accepted | 24ms | 6684 KiB | ||||
26 | Accepted | 24ms | 6772 KiB | ||||
27 | Accepted | 17ms | 6788 KiB | ||||
28 | Accepted | 3ms | 4896 KiB |