Pagini recente » Cod sursa (job #1218098) | Cod sursa (job #2840089) | Cod sursa (job #2746449) | Cod sursa (job #1797527) | Cod sursa (job #3128976)
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
int main()
{
ifstream fin("loto.in");
ofstream fout("loto.out");
int n, s, v[105];
bool found = false;
fin >> n >> s;
for(int i = 0; i < n; i++)
fin >> v[i];
for(int i = 0; i < n && !found; i++)
for(int j = 0; j < n && !found; j++)
for(int k = 0; k < n && !found; k++)
for(int l = 0; l < n && !found; l++)
for(int q = 0; q < n && !found; q++)
for(int w = 0; w < n && !found; w++)
if(v[i] + v[j] + v[k] + v[l] + v[q] + v[w] == s){
fout << v[i] << " " << v[j] << " "<< v[k] << " " << v[l] << " " << v[q] << " " << v[w];
found = true;
}
if(found == false)
fout << -1;
return 0;
}