猫史档案馆


【萌新院】真·简化积木

用户:杰鸽杰鸽查看: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),就是只有同时满足多个条件才会实现目标效果的神奇逻辑!






回复

上一页1 页 / 共 1下一页
假编程猫258假编程猫258

院长,我也发过一个······

点赞0


评论


ftxqgfudiftxqgfudi

喂喂!不许套用我的名字!

点赞0


评论


过去是星能猫副本过去是星能猫副本

对嘛!

点赞0


评论


批小将批小将

刚看到以为是函数

点赞0


评论


慕斯PhOer的老号慕斯PhOer的老号

小鱼头<。)#)))≦




点赞0


评论


小星星『Jerry工作室』小星星『Jerry工作室』

不懂

点赞0


评论


狻_猊狻_猊

了解emotion_编程猫_点赞

点赞0


评论


诸沧海诸沧海

李狗蛋!!!!!!!

洋葱!!!!!

点赞0


评论


凄凉軕谷魡风凄凉軕谷魡风

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


评论


Hy氯化银Hy氯化银

几年前的帖子

点赞0


评论


钟爱银狼的训练师钟爱银狼的训练师

挖坟

点赞0


评论