2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
12
Task/Josephus-problem/PowerShell/josephus-problem-2.psh
Normal file
12
Task/Josephus-problem/PowerShell/josephus-problem-2.psh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Get the prisoner order for a circle of 41 prisoners, selecting every third
|
||||
$Prisoners = Get-JosephusPrisoners -N 41 -K 3
|
||||
|
||||
# Display the prisoner order
|
||||
$Prisoners -join " "
|
||||
|
||||
# Display the last remaining prisoner
|
||||
"Last prisoner remmaining: " + $Prisoners[-1]
|
||||
|
||||
# Display the last three remaining prisoners
|
||||
$S = 3
|
||||
"Last $S remaining: " + $Prisoners[-$S..-1]
|
||||
Loading…
Add table
Add a link
Reference in a new issue