Вопрос:

Задание 206. Составьте для Вычислителя наиболее короткий алгоритм получения из числа 1 чисел 5, 50 и 99.

Ответ:

Чтобы получить число 5 из числа 1:
1 -> +1 = 2
2 -> +1 = 3
3 -> +1 = 4
4 -> +1 = 5
Ответ: +1, +1, +1, +1.

Чтобы получить число 50:
1 -> *2 = 2
2 -> *2 = 4
4 -> *2 = 8
8 -> *2 = 16
16 -> *2 = 32
32 -> *2 = 64
64 -> +1 = 65
65 -> +1 = 66
66 -> +1 = 67
67 -> +1 = 68
68 -> +1 = 69
69 -> +1 = 70
70 -> +1 = 71
71 -> +1 = 72
72 -> +1 = 73
73 -> +1 = 74
74 -> +1 = 75
75 -> +1 = 76
76 -> +1 = 77
77 -> +1 = 78
78 -> +1 = 79
79 -> +1 = 80
80 -> +1 = 81
81 -> +1 = 82
82 -> +1 = 83
83 -> +1 = 84
84 -> +1 = 85
85 -> +1 = 86
86 -> +1 = 87
87 -> +1 = 88
88 -> +1 = 89
89 -> +1 = 90
90 -> +1 = 91
91 -> +1 = 92
92 -> +1 = 93
93 -> +1 = 94
94 -> +1 = 95
95 -> +1 = 96
96 -> +1 = 97
97 -> +1 = 98
98 -> +1 = 99

Чтобы получить 99:
1 -> *2 = 2
2 -> *2 = 4
4 -> *2 = 8
8 -> *2 = 16
16 -> *2 = 32
32 -> *2 = 64
64 -> +1 = 65
65 -> +1 = 66
66 -> +1 = 67
67 -> +1 = 68
68 -> +1 = 69
69 -> +1 = 70
70 -> +1 = 71
71 -> +1 = 72
72 -> +1 = 73
73 -> +1 = 74
74 -> +1 = 75
75 -> +1 = 76
76 -> +1 = 77
77 -> +1 = 78
78 -> +1 = 79
79 -> +1 = 80
80 -> +1 = 81
81 -> +1 = 82
82 -> +1 = 83
83 -> +1 = 84
84 -> +1 = 85
85 -> +1 = 86
86 -> +1 = 87
87 -> +1 = 88
88 -> +1 = 89
89 -> +1 = 90
90 -> +1 = 91
91 -> +1 = 92
92 -> +1 = 93
93 -> +1 = 94
94 -> +1 = 95
95 -> +1 = 96
96 -> +1 = 97
97 -> +1 = 98
98 -> +1 = 99

Ответ: +1, +1, +1, +1.

Похожие