0

# There are 1000 soldiers with a no on their T Shirts 123..9991000 standing on a circular track Man with no1 is carrying a sword in his hand He kills man at no 2 and pass on sword to no 3 This goes on u?

Updated: 9/11/2023

Wiki User

15y ago

977

Ruby program to figure this out:

#!/usr/bin/ruby

class Circle

attr :guys

attr :sword

def initialize(numguys)

@guys = (1 .. numguys).to_a

@sword = 0

end

def inspect

@guys

end

def kill

if @sword + 1 >= @guys.length

if @sword >= @guys.length

@sword = 0

else

@sword = -1

end

end

@sword = @sword + 1

@guys.delete_at(@sword)

end

end

theCircle = Circle.new(1000)

while theCircle.guys.length > 1

theCircle.kill

end

printf "guys: %s\n", theCircle.guys.join(' ')

Wiki User

15y ago

Earn +20 pts
Q: There are 1000 soldiers with a no on their T Shirts 123..9991000 standing on a circular track Man with no1 is carrying a sword in his hand He kills man at no 2 and pass on sword to no 3 This goes on u?
Submit
Still have questions?
Related questions

### Who buries the dead standing up?

During a tour to Vietnam. I visited a North Vietnamese cemetery. I noticed that the headstones were about three feet apart . The dead soldiers were buried standing up just as soldiers are in formation . Soldiers standing forever .

### What is permanent force of professional soldiers called?

The permanent force of professional soldiers is commonly referred to as a standing army.

### What are rows of soldiers standing shoulder to shoulder called?

A row of soldiers standing shoulder to shoulder is called a &quot;formation&quot; or &quot;line&quot;. This formation is used for military drills, ceremonies, and combat situations to maintain alignment and unity among the soldiers.

### Soldiers served US in 1940?

The US had a standing Army &amp; Navy in 1940.

### What is the defionition of a regular army?

a standing army composed of full time soldiers

### How do you give the golden vase to the women?

you have to give it to one of the soldiers standing at the door.

### Is it possible to produce a circular rainbow?

hmmm lol good question....i dont think it matters what the shape of it is....i think all it needs is rain.Ever walk across a sidewalk and see a rainbow puddle on the floor?Thats a circle :) Okay that ^ isn't a good answer... circular rainbows are possible it just depends where you are standing. If you are standing on a hill or mountain it is certainly likely the rainbow will be circular.

### What is a power move?

Making decisions and carrying out plans to further your standing both socially and financially.

### How soldiers in Indian army?

With about 1,414,000 soldiers in active service and about 1,800,000 reserve troops, the Indian Army is the world's second largest active standing army.

### Where was Capt Preston standing during the Boston Massacre?

in between the angry crowd of colonists and his soldiers.

### What is the noun clause in Did you see the Russian soldiers standing outside the embassy building?

The noun clause is 'Did you see the Russian soldiers...'; the noun clause is functioning as the subject of the sentence.

### Does a cylinder have a curved and flat surface?

Yes, a cylinder has both curved and flat surface. Considering a solid cylinder standing on its end, the circular base and the circular top are flat surfaces. The surface connecting the top and bottom is curved.