Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
To solve this kata requires a gift of telepathy. You have to guess which of the possible answers the author believes to be the right one.
Maybe I find strange function in C and С++ test cases
long lrand() {
srand(time(0));
return (((long) rand() << 0) & 0x00000000FFFFFFFFull) |
(((long) rand() << 32) & 0xFFFFFFFF00000000ull);
}
It return long long instead long. As RAND_MAX = 2^31-1 it may be replaced to
long lrand() {
srand(time(0));
return (long) rand() ;
}
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You can view my solution. if delete line with printf C random test crashed.
This is second, simplified solution. About first solution in next post.
For C and C++ random test behaves unpredictable.
This comment is hidden because it contains spoiler information about the solution
This kata demonstrates JS power. 7 lines solution is impressive after C++.
For JS 0<=Math.random()<1