counter-game: initial commit
This commit is contained in:
parent
e54cbddf9c
commit
9c577f8a75
2 changed files with 28 additions and 0 deletions
1
algorithms/bit-manipulation/counter-game/README.md
Normal file
1
algorithms/bit-manipulation/counter-game/README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<https://www.hackerrank.com/challenges/counter-game>
|
||||||
27
algorithms/bit-manipulation/counter-game/game.cpp
Normal file
27
algorithms/bit-manipulation/counter-game/game.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
size_t T;
|
||||||
|
cin >> T;
|
||||||
|
|
||||||
|
while (T--) {
|
||||||
|
|
||||||
|
uint64_t N, count;
|
||||||
|
cin >> N;
|
||||||
|
|
||||||
|
--N;
|
||||||
|
|
||||||
|
for (count = 0; N; ++count) {
|
||||||
|
|
||||||
|
N &= N - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << ((count & 1) ? "Louise" : "Richard") << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue