1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Coding Help Needed To Win Cash Prize

Discussion in 'BlackHat Lounge' started by 1337Indian, Feb 23, 2014.

  1. 1337Indian

    1337Indian Registered Member

    Joined:
    Oct 10, 2013
    Messages:
    68
    Likes Received:
    69
    Occupation:
    IM
    Location:
    In the Jungle
    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: Feb 23, 2014
  2. Junkfood00

    Junkfood00 Elite Member

    Joined:
    Sep 13, 2011
    Messages:
    1,949
    Likes Received:
    1,336
    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 Thanks x 1
  3. 1337Indian

    1337Indian Registered Member

    Joined:
    Oct 10, 2013
    Messages:
    68
    Likes Received:
    69
    Occupation:
    IM
    Location:
    In the Jungle
    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