我们知道1,2,4,8,16,32,64和128这8个数字利用加法可以得到1~255中的任意数字,如 21 = 1 + 4 + 16 192 = 64 + 128 编写一个函数输入1~255的数字,给出如何用1,2,4,8,16,32,64和128 的加法可以到这个数字。
我的解法: 您是VIP用户,您可免回复查看本帖隐藏的内容
|
我们知道1,2,4,8,16,32,64和128这8个数字利用加法可以得到1~255中的任意数字,如 21 = 1 + 4 + 16 192 = 64 + 128 编写一个函数输入1~255的数字,给出如何用1,2,4,8,16,32,64和128 的加法可以到这个数字。
我的解法: 您是VIP用户,您可免回复查看本帖隐藏的内容
|