#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";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
3 | Accepted | 3ms | 2276 KiB | ||||
subtask2 | 25/25 | ||||||
4 | Accepted | 3ms | 2440 KiB | ||||
5 | Accepted | 3ms | 2652 KiB | ||||
6 | Accepted | 3ms | 2868 KiB | ||||
7 | Accepted | 3ms | 3080 KiB | ||||
8 | Accepted | 3ms | 3176 KiB | ||||
subtask3 | 26/26 | ||||||
9 | Accepted | 3ms | 3304 KiB | ||||
10 | Accepted | 2ms | 3420 KiB | ||||
11 | Accepted | 3ms | 3544 KiB | ||||
12 | Accepted | 3ms | 3620 KiB | ||||
13 | Accepted | 3ms | 3624 KiB | ||||
14 | Accepted | 3ms | 3852 KiB | ||||
15 | Accepted | 3ms | 3912 KiB | ||||
16 | Accepted | 3ms | 3856 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Accepted | 3ms | 3876 KiB | ||||
18 | Wrong answer | 3ms | 3852 KiB | ||||
19 | Accepted | 3ms | 3776 KiB | ||||
20 | Accepted | 3ms | 3780 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 24ms | 5876 KiB | ||||
22 | Accepted | 24ms | 5780 KiB | ||||
23 | Accepted | 24ms | 5912 KiB | ||||
24 | Accepted | 24ms | 5912 KiB | ||||
25 | Accepted | 24ms | 5864 KiB | ||||
26 | Accepted | 24ms | 6112 KiB | ||||
27 | Accepted | 16ms | 6180 KiB | ||||
28 | Accepted | 3ms | 4044 KiB |