摘要: Given the input 22, the following sequence of numbers will be printed 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 It is conjectured that the algorithm 阅读全文
posted @ 2018-08-01 14:26 小小的嘤嘤怪 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 这道题可以使用数学公式计算出来。一共工作了n天,则n=1+2+3+4+...+a+b,0<=b<a+1,如n=16,则a=5,b=1。设0.5*(a02+a0)=n,由函数y=0.5*(x2+x)的函数图像可知,0<=a0-a<1。a0向下取整,得到a。然后这道题国王需要支付的金币就可以分两部分计算 阅读全文
posted @ 2018-08-01 10:42 小小的嘤嘤怪 阅读(134) 评论(0) 推荐(0) 编辑
TOP