Cod sursa(job #3283824)

Utilizator David2007David Preda David2007 Data 10 martie 2025 16:02:23
Problema Oite Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("oite.in");
ofstream g("oite.out");

int n,s,nr;
int v[1025];

int main()
{
   f>>n>>s;
   for(int i=1;i<=n;i++)
    f>>v[i];
   sort(v+1,v+1+n);
   for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)
     for(int k=j+1;k<=n;k++)
      for(int l=k+1;l<=n;l++)
        if(v[i]+v[j]+v[k]+v[l]==s)
         nr++;
   cout<<nr;
}