用户:杰鸽查看:1 回复:11 评论:1 创建时间:2017-08-19T08:33:22
原帖:https://www.codemao.cn/wiki/forum/5583
接过他的话茬继续讲。
其实简化积木是一个变通思维的过程,因为简化者一直在思考最优方案,最后得出最讨巧的方法。
闲话少说,直接看——
—————————————————分割线—————————————————————![]()
话说,一天,李狗蛋和神烦狗比赛编程速度,谁输了谁要请对方吃100包辣条。
1.要求:
当点击数是1,3,5,7,9时,让小鱼头显示;当点击数是2,4,6,8,10时,让小鱼头隐藏。第十次点击完毕后,再点击将不会有任何效果。
李狗蛋同学刚看到这道题,立刻吼了声:“So easy!”然后拼接代码:
李狗蛋花了好久时间才拼完这些简单易懂但却麻烦的代码,但他自信地抬望眼时,惊讶地发现,神烦狗已经拼完了!再看小神烦狗的代码,比他简单好多!
:我抓住了1,3,5,7,9都是奇数,2,4,6,8,10都是偶数的信息,但光光这样肯定是不够滴!因为当点击次数大于11时,这行代码就不会在运行了。因此,我选用了“且逻辑”(and),就是只有同时满足多个条件才会实现目标效果的神奇逻辑!
凄凉軕谷魡风imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4%E7%96%91%E9%97%AE.gif"alt="emotion_雷电猴_疑问"
点赞0
评论