#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 | 1980 KiB | ||||
2 | Accepted | 3ms | 2100 KiB | ||||
3 | Accepted | 3ms | 2244 KiB | ||||
subtask2 | 25/25 | ||||||
4 | Accepted | 3ms | 2472 KiB | ||||
5 | Accepted | 3ms | 2684 KiB | ||||
6 | Accepted | 3ms | 2876 KiB | ||||
7 | Accepted | 3ms | 3220 KiB | ||||
8 | Accepted | 3ms | 3340 KiB | ||||
subtask3 | 26/26 | ||||||
9 | Accepted | 3ms | 3596 KiB | ||||
10 | Accepted | 3ms | 3676 KiB | ||||
11 | Accepted | 3ms | 3880 KiB | ||||
12 | Accepted | 3ms | 3988 KiB | ||||
13 | Accepted | 3ms | 4116 KiB | ||||
14 | Accepted | 3ms | 4236 KiB | ||||
15 | Accepted | 3ms | 4244 KiB | ||||
16 | Accepted | 3ms | 4204 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Accepted | 3ms | 4208 KiB | ||||
18 | Wrong answer | 3ms | 4204 KiB | ||||
19 | Accepted | 3ms | 4204 KiB | ||||
20 | Accepted | 3ms | 4112 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 24ms | 6132 KiB | ||||
22 | Accepted | 24ms | 6260 KiB | ||||
23 | Accepted | 24ms | 6404 KiB | ||||
24 | Accepted | 24ms | 6408 KiB | ||||
25 | Accepted | 24ms | 6240 KiB | ||||
26 | Accepted | 23ms | 6360 KiB | ||||
27 | Accepted | 16ms | 6360 KiB | ||||
28 | Accepted | 3ms | 4196 KiB |