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.
Fibonacci Modified
Fibonacci Modified
Sort by
recency
|
726 Discussions
|
Please Login in order to post a comment
Despite having recurrence relation, I have no doubt that this doesn't belong to DP category.
You can use C++'s external library: (gmpxx.h) Note that "Online Judges" don't know about the external library, and if you submit the below code, you are definitely going to fail.
Efficiency and speed are significantly faster than those from Java and Python's built-in libraries. It's worth to learn it because the problem only requires you to implement super simple recurrence relation.
include
include
using namespace std;
int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
}
having to change the printout length because the template assumes string conversion is just cumbersome, the template for python isn't that great
Here is my Python solution!
Java: