Untitled
raw download clone
C
views 23
,
size 751 b
#include <stdio.h>

int main(void)
{
    int t, a[3];
    scanf("%d", &t);
    int temp, x, y, c, b;

    for (int i = 0;i < t;i++)
    {
        scanf("%d %d %d", &a[0], &a[1], &a[2]);
        for (int j = 0;j < 3;j++)
        {
            for (int k = 0;k < 2;k++)
            {
                if (a[k] > a[k + 1])
                {
                    temp = a[k];
                    a[k] = a[k + 1];
                    a[k + 1] = temp;
                }
            }
        }


        if (((a[1] + a[2] - a[0]) / 2) > a[1])
        {
            printf("%d\n", a[0] + a[1]);
        }
        else
        {
            printf("%d\n", a[0] + ((a[1] + a[2] - a[0]) / 2));
        }
    }


    return 0;
close fullscreen
Login or Register to edit or fork this paste. It's free.