Mai intai trebuie sa te autentifici.
Cod sursa(job #3291624)
Utilizator | Data | 5 aprilie 2025 10:57:41 | |
---|---|---|---|
Problema | Oite | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | cex_9 | Marime | 0.43 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("oite.in");
ofstream fout("oite.out");
int n, l, i, j, rasp, c[1026];
unordered_map<int, int> fr;
int main() {
fin >> n >> l;
for(i = 1; i <= n; i++) fin >> c[i];
for(i = 1; i <= n; i++) {
for(j = i + 1; j <= n; j++) rasp += fr[l - (c[i] + c[j])];
for(j = 1; j < i; j++) fr[c[i] + c[j]]++;
}
fout << rasp;
return 0;
}