Cod sursa(job #1437995)
| Utilizator | Data | 18 mai 2015 21:59:50 | |
|---|---|---|---|
| Problema | Loto | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("loto.in");
ofstream fout("loto.out");
int i,a,b,c,d,e,f,n,S,v[200];
int main()
{
fin>>n;
fin>>S;
for(i=1;i<=n;i++)
fin>>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 (v[a]+v[b]+v[c]+v[d]+v[e]+v[f]==S)
{fout<<v[a]<<v[b]<<v[c]<<v[d]<<v[e]<<v[f];
return 0;}
fout<<"-1";
return 0;
}
