Pagini recente » Monitorul de evaluare | Profil ionut287 | Rating Magurean Gabriel Dorin (Gabriel.Magurean) | Cod sursa (job #1727468) | Cod sursa (job #1196979)
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ifstream si("loto.in");
ofstream so("loto.out");
int n,S,a,b,c,d,e,f,C=0;
si>>n>>S;
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 ((a+b+c+d+e+f)==S)
{
so<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" "<<endl;
return 0;
C=1;
}
}
}
}
}
}
}
if (C==0)
{
so<<"-1";
}
return 0;
}