#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector<int> v;
int p = 0;
for (int i = 1; i <= n; i++){
int a; cin >> a;
a = a + p;
v.push_back(a%10);
p = a/10;
}
while (p > 0){
v.push_back(p%10);
p /= 10;
}
int x = 0;
for (int i = n-1; i >= 0; i--){
if (v[i] != 0){
x = i;
break;
}
}
cout << (to_string(v[x]))+string(n-1, '0');
/*
//reverse(v.begin(), v.end());
int mego = v[n-1]; // lehet 0
for (int i = n-2; i >= 0; i--){
//cout << n-i-1 << " " << v[i]/10 << endl;
if (v[i] / 10 >= n-i-1){
mego += v[i]/10;
break;
}
}
cout << (to_string(mego))+string(n-1, '0');
*/
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1852 KiB | ||||
2 | Accepted | 3ms | 2004 KiB | ||||
3 | Accepted | 3ms | 2360 KiB | ||||
subtask2 | 0/25 | ||||||
4 | Wrong answer | 3ms | 2392 KiB | ||||
5 | Wrong answer | 3ms | 2528 KiB | ||||
6 | Wrong answer | 3ms | 2740 KiB | ||||
7 | Wrong answer | 3ms | 2884 KiB | ||||
8 | Wrong answer | 3ms | 3064 KiB | ||||
subtask3 | 0/26 | ||||||
9 | Wrong answer | 3ms | 3188 KiB | ||||
10 | Wrong answer | 3ms | 3340 KiB | ||||
11 | Wrong answer | 3ms | 3344 KiB | ||||
12 | Wrong answer | 3ms | 3468 KiB | ||||
13 | Wrong answer | 3ms | 3600 KiB | ||||
14 | Accepted | 3ms | 3540 KiB | ||||
15 | Wrong answer | 3ms | 3544 KiB | ||||
16 | Wrong answer | 3ms | 3540 KiB | ||||
subtask4 | 0/19 | ||||||
17 | Wrong answer | 3ms | 3668 KiB | ||||
18 | Wrong answer | 3ms | 3548 KiB | ||||
19 | Wrong answer | 3ms | 3560 KiB | ||||
20 | Wrong answer | 3ms | 3552 KiB | ||||
subtask5 | 0/30 | ||||||
21 | Wrong answer | 4ms | 4816 KiB | ||||
22 | Wrong answer | 4ms | 4824 KiB | ||||
23 | Wrong answer | 4ms | 4784 KiB | ||||
24 | Wrong answer | 4ms | 5064 KiB | ||||
25 | Wrong answer | 4ms | 5276 KiB | ||||
26 | Wrong answer | 4ms | 5124 KiB | ||||
27 | Wrong answer | 4ms | 5132 KiB | ||||
28 | Wrong answer | 3ms | 4116 KiB |