Cod sursa(job #878171)

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

h>>s>>n;
for(i=1;i<=n;i++)
h>>v[i];
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 (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";
}