Cod sursa(job #470520)
| Utilizator | Data | 14 iulie 2010 13:48:57 | |
|---|---|---|---|
| Problema | Loto | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("loto.in");
ofstream g("loto.out");
void search (long int n,long int s)
{
long int a,b,c,d,e,f,ok=0;
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)
{
g<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f;
ok=1;
goto begin;
}
if(ok==0)g<<-1;
begin:;
}
int main()
{
long int n,s;
f>>n>>s;
search(n,s);
return 0;
}
