Cod sursa(job #878096)

Utilizator SchullerClaudiuSchuller Claudiu SchullerClaudiu Data 13 februarie 2013 22:45:47
Problema Loto Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream h("loto.in");
ofstream g("loto.out");
int main()
{
      int a,b,c,d,e,f,s,n,i,v[100];
h>>s;
h>>n;
for(i=1;i<=n;i++)
h>>v[i];
for(a=0;a<=n;a++)
        for(b=0;b<=n;b++)
            for(c=0;c<=n;c++)
                for(d=0;d<=n;d++)
                    for(e=0;e<=n;e++)
                        for(f=0;f<=n;f++)
                            if(v[a]+v[b]+v[c]+v[d]+v[e]+v[f]==s)
                            g<<v[a]<<" "<<v[b]<<" "<<v[c]<<" "<<v[d]<<" "<<v[e]<<" "<<v[f] ;
                            else g<<"-1";
    return 0;
}