Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Westicles,validated by @Ayush-Kukreti,@Zimtrolle and @TheOtherAKS.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Westicles,validated by @Ayush-Kukreti,@Zimtrolle and @TheOtherAKS.
If you have any issues, feel free to ping them.
I’ve tried an implementation of Cuhdnovskyl’s algorithm in Java… and in Python. I’ve also tried an implementation of Bellard’s algorithm. I’ve tried optimizing by using parallel streams/threads. I’ve also tried different optimization techniques for factorials and pre-computation of primes. I can get the first test to pass, but all of the other tests fail because I’m out of time. Has anyone solved this in Java? If not, what languages are successful solvers using?
When I click on Solutions I see “Bash” as the one listed. So, I started looking into how to solve this in Bash. Specifically, I looked into using the arctan function a() along with bc (the arbitrary precision decimal arithmetic command). This worked for sequentially solving for pi digits, but quickly became slow as the number of digits increased.
Thanks for any pointers.
The only solution published is in C++. It is wrapped in Bash to get access to the GMP library.
I can’t find any examples of using a bash script to execute custom C++ code in Codingame… that approach seems like a hack to work around Codingame. Is it not possible to solve this in a straightforward way with the supported languages and libraries?
Sure, this was just a lazy way to avoid implementing bignum in C++. No need to do it that way.
But if you are curious, you can do it like this: