Pagini recente » Cod sursa (job #2658265) | Cod sursa (job #882752) | Cod sursa (job #2729800) | Cod sursa (job #707679) | Cod sursa (job #1508627)
#include<stdio.h>
#include<algorithm>
#define N 101*101*101
using namespace std;
FILE *fin,*fout;
int n,s,i,j,k,key,it;
struct chestie
{
int p1;
int p2;
int p3;
int val;
} arr[N],val;
bool comp(chestie a,chestie b)
{
return a.val<b.val;
}
int v[101];
/*bool bs(int x,chestie ches)
{
int pas=1<<17,start=0,end=it;
printf("%d\n",pas);
//printf("BS de %d:\n",x);
for(pas; pas>0; pas=pas>>1)
{
if(start+pas>=end) continue;
//printf("Se cauta in:%d Valoare:%d\n",start+pas,ch[start+pas].sum);
if(ch[start+pas].sum<x) start+=pas;
else if(ch[start+pas].sum==x)
{
printf("%d %d %d %d %d %d",ch[start+pas].a,ch[start+pas].b,ch[start+pas].c,ches.a,ches.b,ches.c);
return 1;
}
}
return 0;
}*/
int main()
{
/*freopen("loto.in","r",stdin);
freopen("loto.out","w",stdout);
scanf("%d%d",&n,&s);
for(i=0; i<n; i++) scanf("%d",&v[i]);
for(i=0; i<n; i++)
for(j=0; j<n; j++)
for(k=0; k<n; k++)
{
ch[it].a=v[i];
ch[it].b=v[j];
ch[it].c=v[k];
ch[it].sum=v[i]+v[j]+v[k];
++it;
}
sort(ch,ch+it,comp);
//for(i=0;i<it;++i) if(bs(s-ch[i].sum,ch[i])) return 0;
printf("-1");
return 0;*/
int pos=0;
fin = freopen("loto.in", "r", stdin);
fout = freopen("loto.out", "w", stdout);
scanf("%d %d", &n, &s);
for(int i = 0; i< n; i++) scanf("%d", &v[i]);
for(int i = 0; i< n; i++)
{
for(int j = i; j< n; j++)
{
for(int k = j; k< n; k++)
{
arr[pos].val = v[i] + v[j] + v[k];
arr[pos].p1 = i;
arr[pos].p2 = j;
arr[pos].p3 = k;
pos++;
}
}
}
}