Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 82c4529

Browse files
authored
Solution
1 parent 734c101 commit 82c4529

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎HackerRank-Counter game/Counter_game.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the counterGame function below.
10+
def counterGame(n):
11+
n = bin(n)[2:]
12+
n = n.split('1')
13+
turns = len(n)+len(n[-1])-2
14+
return 'Louise' if turns&1 else 'Richard'
15+
16+
17+
18+
if __name__ == '__main__':
19+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
20+
21+
t = int(input())
22+
23+
for t_itr in range(t):
24+
n = int(input())
25+
26+
result = counterGame(n)
27+
28+
fptr.write(result + '\n')
29+
30+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /