Skip to content

Instantly share code, notes, and snippets.

@MichelCF
Created February 5, 2017 15:57
Show Gist options
  • Save MichelCF/3ee0469914b223109f7426c0871251af to your computer and use it in GitHub Desktop.
Save MichelCF/3ee0469914b223109f7426c0871251af to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 4 16:00:27 2017
@author: Caiafa
"""
def main():
homens = int(input())
marca = homens
salto = int (input())
lista_homens = range(homens)
while (True):
for posicao in lista_homens[::salto]:
homens =homens -1
print (posicao)
print ((posicao +salto)-marca)
if homens ==0:
print ("posicao : ",lista_homens[posicao])
return 0
elif lista_homens.index(posicao) + salto > marca:
posicao =(posicao +salto)-marca
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment