We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Search
- Beautiful Quadruples
- Discussions
Beautiful Quadruples
Beautiful Quadruples
Sort by
recency
|
36 Discussions
|
Please Login in order to post a comment
def beautifulQuadruples(a, b, c, d): MAX_VALUE = 5000 MAXN = 3001
Reading input and writing output
if name == "main": import os fptr = open(os.environ['OUTPUT_PATH'], 'w')
C++(more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star:) )
Main points:
I found a way mathmateically to calculate the number of ALL combinations where order does not matter. I meant to subtract the number of quadruples where each number XOR = 0 from that total, but it turns out it isn't easy to find that.
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Beautiful Quadruples Problem Solution
Once more, Java "skeleton code" (and I guess the ones for some other languages as well) uses wrong type.
int
is too small to handle all possible values.E.g. for
2997 2998 2999 3000
result is3380890906299
.