Skip to content

Instantly share code, notes, and snippets.

@haje01
Last active August 29, 2015 14:12
Show Gist options
  • Save haje01/87ab6ee513970f2743da to your computer and use it in GitHub Desktop.
Save haje01/87ab6ee513970f2743da to your computer and use it in GitHub Desktop.
def do_case(n, ok):
a = range(2, n+1)
la = len(a)
k = 0
while la > 2:
k = (k + ok - 1) % la
a.pop(k)
la -= 1
return a
if __name__ == "__main__":
c = int(raw_input())
for i in range(c):
n, k = [int(v) for v in raw_input().split()]
f, s = do_case(n, k)
print f, s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment