Pagini recente » Cod sursa (job #3214043) | Cod sursa (job #1721601) | Cod sursa (job #2539109) | Cod sursa (job #821117) | Cod sursa (job #856020)
Cod sursa(job #856020)
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
ifstream fin("loto.in");
ofstream fout("loto.out");
int main()
{
int n, v[101], s;
fin >> n >> s;
for(int i = 1; i <= n; i++)
fin >> v[i];
for(int a = 1; a <= n; a++)
for(int b = 1; b <= n; b++)
for(int c = 1; c <= n; c++)
for(int d = 1; d <= n; d++)
for(int e = 1; e <= n; e++)
for(int f = 1; f <= n; f++)
{
if(v[a] + v[b] + v[c] + v[d] + v[e] + v[f] == s)
{
fout << v[a] << " " << v[b] << " " << v[c] << " " << v[d] << " " << v[e] << " " << v[f];
return 0;
}
}
fout << -1;
fin.close();
fout.close();
return 0;
}