Ответ: Напишем скрипт на python
for x in range(1000, 10000):
a = str(x)
item1 = int(a[0]) + int(a[1])
item2 = int(a[1]) + int(a[2])
item3 = int(a[2]) + int(a[3])
minz = min(item1, item2, item3)
if item1 == minz:
s = str(min(item2, item3)) + str(max(item2, item3))
elif item2 == minz:
s = str(min(item1, item3)) + str(max(item1, item3))
elif item3 == minz:
s = str(min(item1, item2)) + str(max(item1, item2))
if s == '1318':
print(x)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ: Напишем скрипт на python
for x in range(1000, 10000):
a = str(x)
item1 = int(a[0]) + int(a[1])
item2 = int(a[1]) + int(a[2])
item3 = int(a[2]) + int(a[3])
minz = min(item1, item2, item3)
if item1 == minz:
s = str(min(item2, item3)) + str(max(item2, item3))
elif item2 == minz:
s = str(min(item1, item3)) + str(max(item1, item3))
elif item3 == minz:
s = str(min(item1, item2)) + str(max(item1, item2))
if s == '1318':
print(x)