Cod sursa(job #1742031)
| Utilizator | Data | 15 august 2016 18:15:38 | |
|---|---|---|---|
| Problema | Loto | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include<fstream>
#include<set>
using namespace std;
ifstream cin("loto.in");
ofstream cout("loto.out");
set<int> s;
set<int>::iterator it;
int n,a,A[101];
int main(){
cin>>n>>a;
for(int i=0;i<n;i++)cin>>A[i];
for(int i=0;i<n;i++)for(int j= i;j<n;j++)for(int o =j; o<n; o++)for(int k = o;k<n;k++)for(int z=k;z<n;z++)for(int y=z;y<n;y++){
if(A[i]+A[j]+A[o]+A[k]+A[z]+A[y]==a){cout<<A[i]<<" "<<A[j]<<" "<<A[o]<<" "<<A[k]<<" "<<A[z]<<" "<<A[y];return 0;}
}
cout <<"-1";
}
