#include <bits/stdc++.h>
using namespace std;
#define int long long
signed 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 = v.size()-1; i >= 0; i--){
if (v[i] != 0){
x = i;
break;
}
}
cout << (to_string(v[x]))+string(x, '0') << endl;
/*
//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 | 1816 KiB | ||||
2 | Accepted | 3ms | 2288 KiB | ||||
3 | Accepted | 3ms | 2112 KiB | ||||
subtask2 | 25/25 | ||||||
4 | Accepted | 3ms | 2300 KiB | ||||
5 | Accepted | 3ms | 2544 KiB | ||||
6 | Accepted | 3ms | 2784 KiB | ||||
7 | Accepted | 3ms | 2964 KiB | ||||
8 | Accepted | 3ms | 3092 KiB | ||||
subtask3 | 26/26 | ||||||
9 | Accepted | 3ms | 3216 KiB | ||||
10 | Accepted | 3ms | 3428 KiB | ||||
11 | Accepted | 3ms | 3476 KiB | ||||
12 | Accepted | 3ms | 3688 KiB | ||||
13 | Accepted | 3ms | 3656 KiB | ||||
14 | Accepted | 3ms | 3904 KiB | ||||
15 | Accepted | 3ms | 3996 KiB | ||||
16 | Accepted | 3ms | 4088 KiB | ||||
subtask4 | 19/19 | ||||||
17 | Accepted | 3ms | 4084 KiB | ||||
18 | Accepted | 3ms | 4124 KiB | ||||
19 | Accepted | 3ms | 4216 KiB | ||||
20 | Accepted | 3ms | 4328 KiB | ||||
subtask5 | 30/30 | ||||||
21 | Accepted | 78ms | 7976 KiB | ||||
22 | Accepted | 78ms | 9624 KiB | ||||
23 | Accepted | 78ms | 11484 KiB | ||||
24 | Accepted | 78ms | 13324 KiB | ||||
25 | Accepted | 81ms | 15160 KiB | ||||
26 | Accepted | 79ms | 17000 KiB | ||||
27 | Accepted | 48ms | 18204 KiB | ||||
28 | Accepted | 3ms | 16204 KiB |