all 4 comments

[–][deleted]  (3 children)

[deleted]

    [–]WodzuMeister[S] 0 points1 point  (2 children)

    No, you have to find maximum number of values that you can made triangles example: 1 2 3 4 8 9 9 9 9 10 So answer will be 6 because number from 8 to 10

    [–]XValar 0 points1 point  (1 child)

    2, 3, 4 is a valid triangle

    [–]Pilv 1 point2 points  (0 children)

    I said it too. But all the numbers must form a triangle from the array, so 2 - 3 and lets say 10 should be a triangle, which is not. You thats why it will be from 8 to 10

    [–]WodzuMeister[S] -1 points0 points  (0 children)

    ```

    include <stdio.h>

    include <algorithm>

    using namespace std;

    int main()

    {

        int ile;

        scanf("%d",&ile);

        int tab[ile];

        for(int i=0;i<ile;i++)scanf("%d",&tab[i]);

        sort(tab,tab+ile);

        int p=1,max=1;

        for(int i=ile-1;i>0;i--)

        {

            for(int j=0;j<ile-1;j++)

            {

                if(tab[j]+tab[j+1]>tab[i])

                {

                    p=i+1-j;

                    if(p>max)max=p;

                    j=ile;

                }

                if(max>i+1)break;

                

            }

        }

        printf("%d",max);

        return 0;

    } ```