#include <stdio.h>
main()
{
int a[9];
int q,w,e,r,t,y,u,i,o,p,j,f,k;
printf("please input 8 numbers:");
for(i=1; i<9; i++)
{
scanf("%d",&a[i]);
//k=k+a[i];
}
k = a[8]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7];
printf("%d\n",k);
if(k%2==0)
{
for(q=1,f=0; q<9; q++)
for(w=1; w<9&&w!=q; w++)
{
if(w!=q)
{
for(e=1; e<9; e++)
{
if(e!=q&&e!=w)
{
for(r=1; r<9; r++)
{
if(r!=q&&r!=w&&r!=e)
{
for(t=1; t<9; t++)
{
if(t!=q&&t!=w&&t!=e&&t!=r)
{
for(u=1; u<9; u++)
{
if(u!=q&&u!=w&&u!=e&&u!=r&&u!=t)
{
for(o=1; o<9; o++)
{
if(o!=q&&o!=w&&o!=e&&o!=r&&o!=t&&o!=u)
{
for(y=1; y<9; y++)
{
if(y!=q&&y!=w&&y!=e&&y!=r&&y!=t&&y!=u&&y!=o)
{
if((a[w]+a[r]+a[u]+a[o] == k/2)&&(a[q]+a[w]+a[e]+a[r]==k/2)&&
(a[q]+a[w]+a[t]+a[u]==k/2))
{
f=1;
goto out;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
else
printf("error\n");
out:
if(f)
{
printf("they can be constucted required cube as follow:\n");
printf(" %d--------------- %d \n",a[q],a[e]);
printf(" / | / |\n");
printf(" %d-----------------%d |\n",a[w],a[r]);
printf(" | | | |\n");
printf(" | | | |\n");
printf(" | | | |\n");
printf(" | %d-------------- %d\n",a[t],a[y]);
printf(" | / | /\n");
printf(" %d----------------%d\n",a[u],a[o]);
}
else
printf("error\n");
}
main()
{
int a[9];
int q,w,e,r,t,y,u,i,o,p,j,f,k;
printf("please input 8 numbers:");
for(i=1; i<9; i++)
{
scanf("%d",&a[i]);
//k=k+a[i];
}
k = a[8]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7];
printf("%d\n",k);
if(k%2==0)
{
for(q=1,f=0; q<9; q++)
for(w=1; w<9&&w!=q; w++)
{
if(w!=q)
{
for(e=1; e<9; e++)
{
if(e!=q&&e!=w)
{
for(r=1; r<9; r++)
{
if(r!=q&&r!=w&&r!=e)
{
for(t=1; t<9; t++)
{
if(t!=q&&t!=w&&t!=e&&t!=r)
{
for(u=1; u<9; u++)
{
if(u!=q&&u!=w&&u!=e&&u!=r&&u!=t)
{
for(o=1; o<9; o++)
{
if(o!=q&&o!=w&&o!=e&&o!=r&&o!=t&&o!=u)
{
for(y=1; y<9; y++)
{
if(y!=q&&y!=w&&y!=e&&y!=r&&y!=t&&y!=u&&y!=o)
{
if((a[w]+a[r]+a[u]+a[o] == k/2)&&(a[q]+a[w]+a[e]+a[r]==k/2)&&
(a[q]+a[w]+a[t]+a[u]==k/2))
{
f=1;
goto out;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
else
else
printf("error\n");
out:
if(f)
{
printf("they can be constucted required cube as follow:\n");
printf(" %d--------------- %d \n",a[q],a[e]);
printf(" / | / |\n");
printf(" %d-----------------%d |\n",a[w],a[r]);
printf(" | | | |\n");
printf(" | | | |\n");
printf(" | | | |\n");
printf(" | %d-------------- %d\n",a[t],a[y]);
printf(" | / | /\n");
printf(" %d----------------%d\n",a[u],a[o]);
}
else
printf("error\n");
}