-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCTDL040.cpp
47 lines (45 loc) · 1014 Bytes
/
SCTDL040.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @file SCTDL040.cpp
* @author long ([email protected])
* @brief
* @version 0.1
* @date 2023-04-01
*
* @copyright Copyright (c) 2023
*
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int n, num1{0}, num2{0};
vector<int> vt;
cin >> n;
for(int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
vt.push_back(tmp);
}
sort(vt.begin(), vt.end());
while(vt.front() == 0) {
vt.erase(vt.begin());
}
if(vt.size() == 0) {
cout << 0 << endl;
} else {
for(int i=0; i<vt.size(); i+=2) {
num1 *= 10;
num1 += vt[i];
if(i+1 < vt.size()) {
num2 *= 10;
num2 += vt[i+1];
}
}
cout << num1 + num2 << endl;
}
}
}