Last active
August 29, 2015 14:12
-
-
Save haje01/87ab6ee513970f2743da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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