Last active
October 27, 2019 13:45
-
-
Save trhgquan/c14702ccae0cd8f28ce04a36c462048e to your computer and use it in GitHub Desktop.
For more algorithm, visit https://github.com/trhgquan/CPP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SMPAIR - https://codechef.com/problems/SMPAIR | |
* Code by @trhgquan - https://github.com/trhgquan | |
*/ | |
#include<iostream> | |
#include<algorithm> | |
#include<vector> | |
using namespace std; | |
int main() { | |
ios_base::sync_with_stdio(false); cin.tie(NULL); | |
int T, n; cin >> T; | |
while (T--) { | |
cin >> n; | |
vector<int>a; | |
for (int i = 0; i < n; ++i) {int u; cin >> u; a.push_back(u);} | |
sort(a.begin(), a.end()); | |
cout << a[0] + a[1] << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment