1.反复画了下一共就只有四种情况,列举就好。
#include <stdio.h>
int main()
{
int x1;
int x2;
int x3;
int y1;
int y2;
int y3;
int max;
int t;
while (~scanf("%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3))
{
max = 0;
//调整长宽
if (x1 > y1)
{
t = x1;
x1 = y1;
y1 = t;
}
if (x2 > y2)
{
t = x2;
x2 = y2;
y2 = t;
}
if (x3 > y3)
{
t = x3;
x3 = y3;
y3 = t;
}
//调换海报位置
if (y1 > y2
||(y1==y2&&x1>x2))
{
t = x1;
x1 = x2;
x2 = t;
t = y1;
y1 = y2;
y2 = t;
}
if (y1 > y3
||(y1==y3&&x1>x3))
{
t = x1;
x1 = x3;
x3 = t;
t = y1;
y1 = y3;
y3 = t;
}
if (y2 > y3
||(y2==y3&&x2>x3))
{
t = x2;
x2 = x3;
x3 = t;
t = y2;
y2 = y3;
y3 = t;
}
if (x1+x2+x3==y1
&&y1==y2
&&y2==y3)
{
max = y3;
}
else if (x1+x2==y3
&&y1==y2
&&y1+x3==y3)
{
max = y3;
}
else if (y1+y2==y3
&&x1==x2
&&x1+x3==y3)
{
max = y3;
}
else if (x1+y2==y3
&&y1==x2
&&y3==y1+x3)
{
max = y3;
}
if (max == 0)
{
printf("No\n");
}
else
{
printf("%d\n", max);
}
}
return 0;
}