Cod sursa(job #2665777)

Utilizator SkaduweePavel Bogdan Stefan Skaduwee Data 31 octombrie 2020 12:12:27
Problema Numarare triunghiuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <fstream>

using namespace std;
ifstream fin("ntri.in");
ofstream fout("ntri.out");
int v[800],N,i2,s,i,i3,k;
int main()
{fin>>N;
s=1;
while (s<=N)
    {fin>>v[i];
    s++;

    }
i=1;
i2=2;
i3=3;
while (i<N-2)
    {if ((v[i]<v[i2]+v[i3] and v[i]>v[i2]-v[i3]) or (v[i]<v[i2]+v[i3] and v[i]>v[i3]-v[i2]))
        k++;
     if (i3>N)
         {i2++;
          i3=i2+1;
         }
     if (i2==N-1 and i3==N)
         {i++;

         }
     i3++;
    }
fout<<k;
return 0;
}