用C语言编写,the+seven+seven=tyaser,每个字母表示0~9中某个不同的数字。
答案:2 悬赏:60
解决时间 2021-02-23 11:07
- 提问者网友:你在我眼中是最帅
- 2021-02-22 12:50
结果怎么不行呢??求高手帮忙看看,谢谢!!
#include
main()
{
int i,s,e,v,n,h,y,a,r;
long int j,x,k;
for(s=5;s<10;s++)
{
for(e=0;e<10;e++)
if(e!=s)
{
for(v=0;v<10;v++)
if(v!=e&&v!=s)
{
for(n=0;n<10;n++)
if(n!=v&&n!=e&&n!=s)
{
for(h=0;h<10;h++)
if(h!=n&&h!=v&&h!=e&&h!=s)
{
for(y=0;y<10;y++)
if(y!=h&&y!=n&&y!=v&&y!=e&&y!=s)
{
for(a=0;a<10;a++)
if(a!=y&&a!=h&&a!=n&&a!=v&&a!=e&&a!=s)
{
for(r=0;r<10;r++)
if(r!=a&&r!=y&&r!=h&&r!=n&&r!=v&&r!=e&&r!=s)
{
i=100+h*10+e;
j=s*10000+e*1000+v*100+e*10+n;
k=100000+y*10000+a*1000+s*100+e*10+r;
x=i+j+j;
if(x==k)
{
printf("s=%d e=%d v=%d n=%d h=%d y=%d a=%d r=%
d\n",s,e,v,n,h,y,a,r);
printf("the+seven+seven=tyaser:\n");
printf("%d+%d+%d=%d\n",i,j,j,k);
}
}
}
}
}
}
}
}
}
getch();
}
t可以知道是1了,所以没有for编写t
最佳答案
- 二级知识专家网友:我的任性你不懂
- 2021-02-22 13:26
方法是对的
少了t的计算
#include
void main()
{
int i,s,e,v,n,h,y,a,r,t;
long int j,x,k;
for(s=1;s<10;s++)
{
for(e=0;e<10;e++)
if(e!=s)
{
for(v=0;v<10;v++)
if(v!=e&&v!=s)
{
for(n=0;n<10;n++)
if(n!=v&&n!=e&&n!=s)
{
for(h=0;h<10;h++)
if(h!=n&&h!=v&&h!=e&&h!=s)
{
for(y=0;y<10;y++)
if(y!=h&&y!=n&&y!=v&&y!=e&&y!=s)
{
for(a=0;a<10;a++)
if(a!=y&&a!=h&&a!=n&&a!=v&&a!=e&&a!=s)
{
for (t=0;t<10;t++)
{ if(t!=y&&t!=h&&t!=n&&t!=v&&t!=e&&t!=s&&t!=a)
for(r=0;r<10;r++)
if(r!=a&&r!=y&&r!=h&&r!=n&&r!=v&&r!=e&&r!=s)
{
i=100*t+h*10+e;
j=s*10000+e*1000+v*100+e*10+n;
k=100000*t+y*10000+a*1000+s*100+e*10+r;
x=i+j+j;
if(x==k)
{
printf("s=%d e=%d v=%d n=%d h=%d y=%d a=%d r=%d\n",s,e,v,n,h,y,a,r);
printf("the+seven+seven=tyaser:\n");
printf("%d+%d+%d=%d\n",i,j,j,k);
int x;
scanf("%s",x);
}
}
}
}
}
}
}
}
}
}
}
全部回答
- 1楼网友:开心就好
- 2021-02-22 13:48
你好!
唉!你程序的可读性太差老……
我的回答你还满意吗~~
我要举报
大家都在看
推荐资讯