Pagini recente » Cod sursa (job #88437) | Cod sursa (job #2562615) | Cod sursa (job #1056433) | Cod sursa (job #2916347) | Cod sursa (job #1222010)
#include <algorithm>
#include <vector>
#include <stdio.h>
#define NMAX 101
#define llong long long
using namespace std;
struct three {
three(int zero, int one, int two) {
this->zero = zero;
this->one = one;
this->two = two;
this->sum = zero + one + two;
}
llong sum;
int zero, one, two;
};
int numbers[NMAX];
vector<three> threes;
bool compare_threes(three t1, three t2) {
return t1.sum < t2.sum;
}
int main() {
freopen("loto.in", "rt", stdin);
freopen("loto.out", "wt", stdout);
llong n, s;
scanf("%lld %lld\n", &n, &s);
for (int i = 0; i < n; i++) {
scanf("%d", &numbers[i]);
}
threes.reserve(n * n * n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < n; k++) {
three element(numbers[i], numbers[j], numbers[k]);
threes.push_back(element);
}
}
}
sort(threes.begin(), threes.end(), compare_threes);
return 0;
// for (it = threes.rbegin(); it != threes.rend(); it++) {
// llong first_sum = it->first;
// llong second_sum = s - first_sum;
// sit = threes.find(second_sum);
// if (sit != threes.end()) {
// printf("%d %d %d %d %d %d\n", it->second.zero, it->second.one, it->second.two, sit->second.zero, sit->second.one, sit->second.two);
// return 0;
// }
// }
printf("%d\n", -1);
return 0;
}