Вопрос:

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

Ответ:

Чтобы получить число 5 из числа 1:\n1 -> +1 = 2\n2 -> +1 = 3\n3 -> +1 = 4\n4 -> +1 = 5\nОтвет: +1, +1, +1, +1.\n\nЧтобы получить число 50:\n1 -> *2 = 2\n2 -> *2 = 4\n4 -> *2 = 8\n8 -> *2 = 16\n16 -> *2 = 32\n32 -> *2 = 64\n64 -> +1 = 65\n65 -> +1 = 66\n66 -> +1 = 67\n67 -> +1 = 68\n68 -> +1 = 69\n69 -> +1 = 70\n70 -> +1 = 71\n71 -> +1 = 72\n72 -> +1 = 73\n73 -> +1 = 74\n74 -> +1 = 75\n75 -> +1 = 76\n76 -> +1 = 77\n77 -> +1 = 78\n78 -> +1 = 79\n79 -> +1 = 80\n80 -> +1 = 81\n81 -> +1 = 82\n82 -> +1 = 83\n83 -> +1 = 84\n84 -> +1 = 85\n85 -> +1 = 86\n86 -> +1 = 87\n87 -> +1 = 88\n88 -> +1 = 89\n89 -> +1 = 90\n90 -> +1 = 91\n91 -> +1 = 92\n92 -> +1 = 93\n93 -> +1 = 94\n94 -> +1 = 95\n95 -> +1 = 96\n96 -> +1 = 97\n97 -> +1 = 98\n98 -> +1 = 99\n\nЧтобы получить 99:\n1 -> *2 = 2\n2 -> *2 = 4\n4 -> *2 = 8\n8 -> *2 = 16\n16 -> *2 = 32\n32 -> *2 = 64\n64 -> +1 = 65\n65 -> +1 = 66\n66 -> +1 = 67\n67 -> +1 = 68\n68 -> +1 = 69\n69 -> +1 = 70\n70 -> +1 = 71\n71 -> +1 = 72\n72 -> +1 = 73\n73 -> +1 = 74\n74 -> +1 = 75\n75 -> +1 = 76\n76 -> +1 = 77\n77 -> +1 = 78\n78 -> +1 = 79\n79 -> +1 = 80\n80 -> +1 = 81\n81 -> +1 = 82\n82 -> +1 = 83\n83 -> +1 = 84\n84 -> +1 = 85\n85 -> +1 = 86\n86 -> +1 = 87\n87 -> +1 = 88\n88 -> +1 = 89\n89 -> +1 = 90\n90 -> +1 = 91\n91 -> +1 = 92\n92 -> +1 = 93\n93 -> +1 = 94\n94 -> +1 = 95\n95 -> +1 = 96\n96 -> +1 = 97\n97 -> +1 = 98\n98 -> +1 = 99\n\nОтвет: +1, +1, +1, +1.

Похожие