Cod sursa(job #675445)
| Utilizator | Data | 7 februarie 2012 16:57:04 | |
|---|---|---|---|
| Problema | Loto | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include<iostream>
#include<fstream>
#include<algorithm>
using namespace std;
int a[1000001];
int v[101],l;
int main ()
{
int n,i,j,k,sum,c,d;
ifstream f("loto.in");
ofstream g("loto.out");
f>>n>>sum;
for(i=1;i<=n;i++)
f>>v[i];
f.close();
l=0;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(k=1;k<=n;k++)
if((v[i]+v[j]+v[k])<sum) {
l++;
a[l]=v[i]+v[j]+v[k];
}
sort(a+1,a+l+1);
g.close();
return 0;
}