Use 1 instead of 2, makes the bitshift easier.
This commit is contained in:
parent
22ff7b923d
commit
87f5e242dc
@ -36,7 +36,7 @@ public class DoublesGame {
|
||||
if(a == 0) {
|
||||
System.out.println("Goodbye!");
|
||||
break;
|
||||
} else if(a != 2 << (n - 1)) {
|
||||
} else if(a != 1 << n) {
|
||||
System.out.println("Wrong answer, try again.");
|
||||
} else {
|
||||
System.out.println("Correct!");
|
||||
|
@ -34,7 +34,7 @@ int main(void) {
|
||||
if(a == 0) {
|
||||
std::cout << "Goodbye!\n";
|
||||
return 0;
|
||||
} else if(a not_eq 2 << (n - 1)) {
|
||||
} else if(a not_eq 1 << n) {
|
||||
std::cout << "Wrong answer, try again.\n";
|
||||
} else {
|
||||
std::cout << "Correct!\n";
|
||||
|
@ -31,7 +31,7 @@ while True:
|
||||
if a is 0:
|
||||
print("Goodbye!")
|
||||
break
|
||||
elif a is not 2 << (n - 1):
|
||||
elif a is not 1 << n:
|
||||
print("Wrong answer, try again.")
|
||||
else:
|
||||
print("Correct!")
|
||||
|
@ -32,7 +32,7 @@ do
|
||||
then
|
||||
echo "Goodbye!"
|
||||
break
|
||||
elif [ $a -ne $((2 << ($n - 1))) ]
|
||||
elif [ $a -ne $((1 << $n)) ]
|
||||
then
|
||||
echo "Wrong answer, try again."
|
||||
else
|
||||
|
@ -33,7 +33,7 @@ int main(void) {
|
||||
if(a == 0) {
|
||||
printf("Goodbye!\n");
|
||||
return 0;
|
||||
} else if(a != 2 << (n - 1)) {
|
||||
} else if(a != 1 << n) {
|
||||
printf("Wrong answer, try again.\n");
|
||||
} else {
|
||||
printf("Correct!\n");
|
||||
|
Loading…
Reference in New Issue
Block a user