Coding Help Needed To Win Cash Prize

1337Indian

Registered Member
Joined
Oct 10, 2013
Messages
68
Reaction score
70
Hello BHW.
My college has organized an online coding event (Made using ONJ) . Participants have to solve 5 coding problems using C/C++. I got 2 right. Now, I'm struggling with the third.
Winner gets $50. I wish to win this so that I can invest the money in some tools.

I kindly request programmers at BHW to help me as much as possible.

Here's the problem-

UPDATE: Problem removed after figuring it out. I don't want to get caught cheating.
BH ways forever :D

Thanks a lot Junkfood00. If the rep system was there I would have +repped you.
 
Last edited:
wtf? a competition in coding and using the internet is allowed?

I've been in a similar thing, I'm in Europe, not necessarily the same organizer and we weren't allowed access to the internet.

To answer your question, I would do this:

- Create static variables, outside the function, because recursions will build call stacks so vars in the func won't work
- Read first value then run a loop through the rest of the lines
- In the loop above, reset the static vars and calculate the fibonacci nr, remember to increment the vars in the func.
 
wtf? a competition in coding and using the internet is allowed?

I've been in a similar thing, I'm in Europe, not necessarily the same organizer and we weren't allowed access to the internet.

To answer your question, I would do this:

- Create static variables, outside the function, because recursions will build call stacks so vars in the func won't work
- Read first value then run a loop through the rest of the lines
- In the loop above, reset the static vars and calculate the fibonacci nr, remember to increment the vars in the func.
Thanks for your reply. A pseudo code will be more helpful. I'm not very good in coding.
About the internet connection, they just disconnected the Ethernet cable. I'm using my mobile's internet on the computer wirelessly. :D
 
Back
Top