-
-
Save lyrieek/61b435d26c10aba82b17d65f180199ab to your computer and use it in GitHub Desktop.
2021 java
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
final int seed = 0xffff; | |
final int round = seed >> 1; | |
for (int i = seed; i > 0; i--) { | |
Random foo = new Random(seed); | |
Random bar = new Random(seed); | |
int reverse = 0; | |
int temp = i; | |
while(temp != 0) { | |
reverse = reverse * 10 + (temp % 10); | |
temp /= 10; | |
} | |
if (i == reverse || i % 10 == 0 || reverse > seed) { | |
continue; | |
} | |
IntStream.range(0, i).forEach(e -> foo.nextInt()); | |
IntStream.range(0, reverse).forEach(e -> bar.nextInt()); | |
int res = foo.nextInt(round); | |
if (res == bar.nextInt(round)) { | |
System.out.println(res); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment