Cod sursa(job #878165)

Utilizator SchullerClaudiuSchuller Claudiu SchullerClaudiu Data 14 februarie 2013 08:36:28
Problema Loto Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
using namespace std;
ifstream h("loto.in");
ofstream g("loto.out");
int main()
{
      long a,b,c,d,e,f,s,n,i,v[100],r=1;
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 (r)
{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] ;
r=0;}
if(r) g<<"-1";
}