Pagini recente » Cod sursa (job #1126130) | Cod sursa (job #1488468) | Cod sursa (job #1166051) | Cod sursa (job #878538) | Cod sursa (job #1008799)
#include <iostream>
#include <fstream>
#include <algorithm>
#define Bluc 805
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int n,v[Bluc],usor;
void citire() {
in >> n;
for (int i=1; i<=n; i++) in >> v[i];
}
void copiated() {
sort(v+1,v+n+1);
}
void easy_copy_paste() {
for (int i=1; i<=n-2; i++)
for (int j=i+1; j<=n-1; j++)
for (int h=j+1; h<=n; h++){
if (v[i]+v[j]>=v[h]) usor++;
else break;
}
out << usor;
}
int main()
{
citire();
copiated();
easy_copy_paste();
return 0;
}