#include<iostream>
using namespace std;
int sqr(int x)
{
return x*x;
}
int main()
{
int a,b,c,x,y,z,ans;
while(cin>>a>>b>>c>>x>>y>>z&&!(a==0&&b==0&&c==0&&x==0&&y==0&&z==0))
{
if(x==0||y==0||z==0) ans=x*x+y*y+z*z;
else
{
if(x==a) ans=min(min(sqr(x+y)+z*z,sqr(x+z)+y*y),min(sqr(c+y)+sqr(a+c-z),sqr(b+z)+sqr(a+b-y)));
if(y==b) ans=min(min(sqr(y+x)+z*z,sqr(y+z)+x*x),min(sqr(a+z)+sqr(b+a-x),sqr(c+x)+sqr(b+c-z)));
if(z==c) ans=min(min(sqr(z+x)+y*y,sqr(z+y)+x*x),min(sqr(a+y)+sqr(c+a-x),sqr(b+x)+sqr(c+b-y)));
}
cout<<ans<<endl;
}
return 0;
}
还以为
if(x==a) ans=
min(
sqr(x+y)+z*z,
sqr(x+z)+y*y)就行了的,考虑得太不周全了