A beginner of ACMers
My code:
#include <stdio.h>
#define maxn 100
int judge(int a,int b,int c);
int main()
{
int n, ins[maxn];
while (scanf("%d", &n) != EOF)
{
int max = 0, sum = 0, temp = 0;
for (int i = 0; i < n; i++)
scanf("%d", &ins[i]);
for (int i = 0; i < n; i++)
for (int j = i+1; j < n; j++)
for (int k = j+1; k < n; k++)
{
sum = ins[i]+ins[j]+ins[k];
temp = judge(ins[i],ins[j],ins[k]);
if (temp < sum-temp)
max = max > sum ? max:sum;
}
printf("%d\n", max);
}
return 0;
}
int judge(int a, int b, int c)
{
int max = a;
if (max < b) max = b;
if (max < c) max = c;
return max;
}