Sort 7 Discussions, By:
Please Login in order to post a comment
The crucial point here is to generate permutations without duplicates like C++ std::next_permutation(). I don't think using itertools.permutations is appropriate here. Also, skip those permutations with preceding zeros. (e.g. start with 100000000003 instead of 000000000013) Then you won't get into TLE trouble with cases like 15 0, 24 0, 31 0, 33 0, 34 0 and 35 0. And don't forget the prime .
how to do it in c++
Did anyone solve this in C++? If so, how did you implement prime testing for bigint's?
Has any one tried this with Java ?
The only option in java to handle such huge numbers is BigInteger which is extremely slow.
What are options to handle such huge numbers with fast processing in other languages ?
Help or suggestion would be really appreciable.
why i'm getting abort called