Pagini recente » Cod sursa (job #938670) | Cod sursa (job #141915) | Cod sursa (job #2318151) | Cod sursa (job #1534822) | Cod sursa (job #470522)
Cod sursa(job #470522)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("loto.in");
ofstream g("loto.out");
long int n,s,x[101];
void citire()
{
int i;
f>>n>>s;
for(i=1; i<=n; i++)
f>>x[i];
f.close();
}
void search ()
{
long int a,b,c,d,e,f;
for(a=1; a<=n; a++)
for(b=1; b<=n; b++)
for(c=1; c<=n; c++)
for(d=1; d<=n; d++)
for(e=1; e<=n; e++)
for(f=1; f<=n; f++)
if(x[a]+x[b]+x[c]+x[d]+x[e]+x[f]==s)
{
g<<x[a]<<" "<<x[b]<<" "<<x[c]<<" "<<x[d]<<" "<<x[e]<<" "<<x[f];
g.close();
return;
}
g<<-1;
g.close();
}
int main()
{
citire();
search();
return 0;
}