sumim #3782(2007/11/09 18:21 GMT) [ Smalltalk ] Rating1/1=1.00
1 2 3 4 5 6 7 8 9 10 11 12
| solveA | solveA := [:n :k :m | | circle | circle := (1 to: n) asOrderedCollection. [circle size > 1] whileTrue: [ circle removeAt: m. m := (m - 1 + k - 1) \\ circle size + 1]. circle first]. solveA valueWithArguments: #(8 5 3). "=> 1 " solveA valueWithArguments: #(100 9999 98). "=> 93 " solveA valueWithArguments: #(10000 10000 10000). "=> 2019 "
Rating1/1=1.00-0+
[ reply ]
sumim
#3782()
[
Smalltalk
]
Rating1/1=1.00
| solveA | solveA := [:n :k :m | | circle | circle := (1 to: n) asOrderedCollection. [circle size > 1] whileTrue: [ circle removeAt: m. m := (m - 1 + k - 1) \\ circle size + 1]. circle first]. solveA valueWithArguments: #(8 5 3). "=> 1 " solveA valueWithArguments: #(100 9999 98). "=> 93 " solveA valueWithArguments: #(10000 10000 10000). "=> 2019 "Rating1/1=1.00-0+
[ reply ]