mirror of
https://github.com/tiennm99/codechef.git
synced 2026-08-08 02:24:24 +00:00
[Add] solved solutions
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <climits>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
long long t, n, min1, min2, temp;
|
||||
cin >> t;
|
||||
while (t--) {
|
||||
cin >> n;
|
||||
min1 = INT_MAX;
|
||||
min2 = INT_MAX;
|
||||
for (long long i = 0; i < n; ++i) {
|
||||
cin >> temp;
|
||||
if (temp < min1) {
|
||||
min2 = min1;
|
||||
min1 = temp;
|
||||
} else if (temp < min2) {
|
||||
min2 = temp;
|
||||
}
|
||||
}
|
||||
cout << min1 + min2 << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user