回答編集履歴
6
修正
test
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
if int("{}{}{}{}".format(S,E,N,D)) + int("{}{}{}{}".format(M,O,R,E)) == int("{}{}{}{}{}".format(M,O,N,E,Y)):
|
42
42
|
|
43
|
-
print(S,E,N,D,M,O,R,
|
43
|
+
print(S,E,N,D,M,O,R,Y)
|
44
44
|
|
45
45
|
````if`で分岐
|
46
46
|
|
5
修正
test
CHANGED
@@ -43,3 +43,5 @@
|
|
43
43
|
print(S,E,N,D,M,O,R,y)
|
44
44
|
|
45
45
|
````if`で分岐
|
46
|
+
|
47
|
+
[format関数](https://note.nkmk.me/python-format-zero-hex/#strformat)を使っています。
|
4
修正
test
CHANGED
@@ -31,3 +31,15 @@
|
|
31
31
|
print(B, E, M, O)
|
32
32
|
|
33
33
|
```とかになるのではないでしょうか?
|
34
|
+
|
35
|
+
-----追記-----
|
36
|
+
|
37
|
+
`S`,`E`,`N`,`D`,`M`,`O`,`R`,`Y`を`for`文で回して、
|
38
|
+
|
39
|
+
```Python
|
40
|
+
|
41
|
+
if int("{}{}{}{}".format(S,E,N,D)) + int("{}{}{}{}".format(M,O,R,E)) == int("{}{}{}{}{}".format(M,O,N,E,Y)):
|
42
|
+
|
43
|
+
print(S,E,N,D,M,O,R,y)
|
44
|
+
|
45
|
+
````if`で分岐
|
3
修正
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
for B, E, M, O in product(range(10), range(
|
27
|
+
for B, E, M, O in product(range(10), range(10), range(10), range(10)):
|
28
28
|
|
29
29
|
if (B * 10 + E) ** 2 == M * 100 + O * 10 + B:
|
30
30
|
|
2
修正
test
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
```Python
|
4
4
|
|
5
|
-
for B in range(1
|
5
|
+
for B in range(10):
|
6
6
|
|
7
7
|
for E in range(10):
|
8
8
|
|
9
|
-
for M in range(1
|
9
|
+
for M in range(10):
|
10
10
|
|
11
11
|
for O in range(10):
|
12
12
|
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
for B, E, M, O in product(range(1
|
27
|
+
for B, E, M, O in product(range(10), range(9), range(10), range(9)):
|
28
28
|
|
29
29
|
if (B * 10 + E) ** 2 == M * 100 + O * 10 + B:
|
30
30
|
|
1
修正
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
print(B, E, M, O)
|
16
16
|
|
17
|
-
```とかにな
|
17
|
+
```とかになって、
|
18
18
|
|
19
19
|
`itertools`だったら、
|
20
20
|
|