#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];
}
}
if(lposIndex==(a-1)) {
cout << 0 << "\n";
return 0;
}
}
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 | 2060 KiB | ||||
3 | Accepted | 3ms | 2252 KiB | ||||
subtask2 | 25/25 | ||||||
4 | Accepted | 3ms | 2480 KiB | ||||
5 | Accepted | 3ms | 2692 KiB | ||||
6 | Accepted | 3ms | 2904 KiB | ||||
7 | Accepted | 3ms | 2968 KiB | ||||
8 | Accepted | 3ms | 2964 KiB | ||||
subtask3 | 26/26 | ||||||
9 | Accepted | 3ms | 3188 KiB | ||||
10 | Accepted | 3ms | 3284 KiB | ||||
11 | Accepted | 3ms | 3304 KiB | ||||
12 | Accepted | 3ms | 3384 KiB | ||||
13 | Accepted | 3ms | 3504 KiB | ||||
14 | Accepted | 2ms | 3584 KiB | ||||
15 | Accepted | 3ms | 3952 KiB | ||||
16 | Accepted | 3ms | 3852 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Accepted | 3ms | 4228 KiB | ||||
18 | Wrong answer | 3ms | 3864 KiB | ||||
19 | Accepted | 3ms | 4008 KiB | ||||
20 | Accepted | 3ms | 3872 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 24ms | 5948 KiB | ||||
22 | Accepted | 24ms | 5956 KiB | ||||
23 | Accepted | 24ms | 5952 KiB | ||||
24 | Accepted | 24ms | 5952 KiB | ||||
25 | Accepted | 24ms | 5960 KiB | ||||
26 | Accepted | 24ms | 5972 KiB | ||||
27 | Accepted | 16ms | 5980 KiB | ||||
28 | Accepted | 3ms | 3924 KiB |