## oj刷题：猜灯谜

jlqwer 发表于 代码 分类，标签: 热度:446°

Description

A 村的元宵节灯会上有一迷题：

请猜谜 * 请猜谜 = 请边赏灯边猜

Input

Output

Sample Input

HINT

``` 1 #include<stdio.h>
2 int main()
3 {
4     int a,b,c,d,f,m,x,y; /* a=请 b=边 c=赏 d=灯 f=猜 m=迷   */
5     for(a=1;a<10;a++)
6     {
7         for(b=0;b<10;b++)
8         {
9             if (a==b)
10             continue;
11             for(c=0;c<10;c++)
12             {
13                 if (b==c || c==a)
14                 continue;
15                 for(d=0;d<10;d++)
16                 {
17                     if (d==c || d==b || d==a)
18                     continue;
19                     for (f=0;f<10;f++)
20                     {
21                         if (f==d || f==c || f==b || f==a)
22                         continue;
23                         for(m=0;m<10;m++)
24                         {
25                             if (m==f || m==d || m==c || m==b || m==a)
26                             continue;
27                                 {
28                                     x=(a*100+f*10+m);
29                                     y=(a*100000+b*10000+c*1000+d*100+b*10+f);
30                                     if ((x*x)==y)
31                                         printf("%d\n",x);
32                                 }
33                         }
34                     }
35                 }
36
37             }
38         }
39     }
40     return 0;
41 }```

lll