Pagini recente » Cod sursa (job #1040910) | Cod sursa (job #280481) | Cod sursa (job #1910166) | Cod sursa (job #2518042) | Cod sursa (job #1464998)
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <climits>
#include <list>
#include <iomanip>
#include <cstdlib>
#include <fstream>
#include <map>
#include <algorithm>
#define nmax 10
using namespace std;
void afis (int** m, int n, int k) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= k; j++)
cout << m[i][j] << " ";
cout << "\n";
}
cout << "\n";
}
int main() {
freopen("loto.in", "r", stdin);
freopen("loto.out", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, s;
cin >> n >> s;
int* v = new int[n];
for (int i = 0; i < n; i++)
cin >> v[i];
for (int x1 = 0; x1 < n; x1++)
for (int x2 = x1; x2 < n; x2++)
for (int x3 = x2; x3 < n; x3++)
for (int x4 = x3; x4 < n; x4++)
for (int x5 = x4; x5 < n; x5++)
for (int x6 = x5; x6 < n; x6++)
if (v[x1] + v[x2] + v[x3] + v[x4] + v[x5] + v[x6] == s) {
cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6;
return 0;
}
cout << -1;
return 0;
}