Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Don't Stair at Me

By ishtupeed · Limits 1s, 512 MB

Believe it or not, the most difficult part of a programming contest is to come up with a problem that can be solved by anyone who knows how to write a simple print statement. So when I was tasked to construct such a problem, you can understand that I was in a pickle. So what I did is, I started walking on a road, scratching my head, brainstorming different problem ideas. While walking, I encountered my friend Ociz. Ociz has this habit of babbling about things that he did before. He said, “A few days ago, I encountered a peculiar stairway. You know I like to skip steps while going up the stairs, don't you? Serves as a bit of exercise, as well. So if I go up this stairway, two steps at a time, at the end of the stairs, I need to take a single step to reach the top landing. If I go up taking three steps at a time, at the end of the stairs, I need two steps to reach the landing. If I go up taking four steps at a time, three steps are required at the end. If I take five steps at a time, four are left. If I take six steps at a time, five are left. If I take seven, six are left.” So I started thinking one step (pun not intended) ahead: what is the minimum number of steps that the stairway can have?
In this problem, your task is to print the number of steps in that stairway. Understand that the bottom floor does not count as a step. However, the top landing can be considered as a step.

To help you solve the problem here's a C/C++ code we found on the internet that can be used to print the answer:

#include <stdio.h>

int main(void)
    return 0;


There is no input to the problem.


Output a single number, denoting the answer to the problem.



    78% Solution Ratio

    fragilisticEarliest, 1M ago

    NJRafiFastest, 0.0s

    NJRafiLightest, 0 B

    hredhayxzShortest, 3B


    Login to submit

    Toph uses cookies. By continuing you agree to our Cookie Policy.