#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";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1828 KiB | ||||
2 | Accepted | 3ms | 2016 KiB | ||||
3 | Accepted | 3ms | 2228 KiB | ||||
subtask2 | 0/25 | ||||||
4 | Wrong answer | 3ms | 2316 KiB | ||||
5 | Accepted | 3ms | 2544 KiB | ||||
6 | Accepted | 3ms | 2524 KiB | ||||
7 | Accepted | 3ms | 2756 KiB | ||||
8 | Accepted | 3ms | 2792 KiB | ||||
subtask3 | 26/26 | ||||||
9 | Accepted | 3ms | 2984 KiB | ||||
10 | Accepted | 3ms | 3056 KiB | ||||
11 | Accepted | 3ms | 3292 KiB | ||||
12 | Accepted | 3ms | 3392 KiB | ||||
13 | Accepted | 2ms | 3480 KiB | ||||
14 | Accepted | 3ms | 3592 KiB | ||||
15 | Accepted | 3ms | 3560 KiB | ||||
16 | Accepted | 3ms | 3696 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Accepted | 3ms | 4060 KiB | ||||
18 | Wrong answer | 3ms | 4012 KiB | ||||
19 | Accepted | 3ms | 4016 KiB | ||||
20 | Accepted | 3ms | 3912 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 23ms | 6008 KiB | ||||
22 | Accepted | 23ms | 6296 KiB | ||||
23 | Accepted | 23ms | 6496 KiB | ||||
24 | Accepted | 23ms | 6448 KiB | ||||
25 | Accepted | 23ms | 6456 KiB | ||||
26 | Accepted | 23ms | 6580 KiB | ||||
27 | Accepted | 16ms | 6508 KiB | ||||
28 | Accepted | 3ms | 4416 KiB |