举报
早上大家都起床,各自心怀鬼胎的分椰子了,这个猴子还真不是一般的幸运,因为这次把椰子分成5分后居然还是多一个椰子,只好又给它了.
Dim $i = 0 Dim $total Do $i = $i + 1 $total = tg($i) Until IsInt($total) MsgBox(0, "答案", "椰子最少有 " & $total & "个。") Func tg($f) Local $a, $b, $c, $d, $g $e = (5 * $f) / 4 + 1 / 4 $d = (5 * $e) / 4 + 1 / 4 $c = (5 * $d) / 4 + 1 / 4 $b = (5 * $c) / 4 + 1 / 4 $a = (5 * $b) / 4 + 1 / 4 $g = 5 * $a + 1 Return $g EndFunc ;==>tg
Dim $i = 0 Dim $total Do $i = $i + 1 $total = tg($i) Until IsInt($total) MsgBox(0, "答案", "椰子最少有 " & (5 * $total + 1) & "个。") Func tg($a) For $i = 1 To 5 $a = (5 * $a + 1) / 4 Next Return $a EndFunc ;==>tg
查看全部评分
Dim $i=0 Do $i=$i+1 $a=(($i-1)/5)*4 $b=(($a-1)/5)*4 $c=(($b-1)/5)*4 $d=(($c-1)/5)*4 $f=(($d-1)/5)*4 $g=(($f-1)/5) Until IsInt($g) MsgBox(0,"",$i)
Local $itime = TimerInit() MsgBox(0, TimerDiff($itime), test(1, 6)) ;参数依次为:每堆个数,分几次,记录当前最后一次分到的个数 Func test($num, $lever, $i = 1) $num = $num * 5 + 1 If $lever = 1 Then Return $num Else If Mod($num, 4) = 0 Then Return test($num / 4, $lever - 1, $i) Else Return test($i + 1, 6, $i + 1) EndIf EndIf EndFunc ;==>test
本版积分规则 发表回复 回帖后跳转到最后一页
|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度
GMT+8, 2025-10-24 20:42 , Processed in 0.081282 second(s), 21 queries .
Powered by Discuz! X3.5 Licensed
© 2001-2025 Discuz! Team.