Lisa's Workbook

  • + 0 comments

    Finally passed test case 6 with this, although I'm still not sure why. Is there any way to get a look at the test cases?

    int main() { int chapters{0}, problemsPerPage{0}, problemsInChapter{0}, pageNumber{0}, specials{0};

    cin >> chapters >> problemsPerPage;
    
    while (cin >> problemsInChapter)
        for (int problemNumber{0};
             problemNumber < problemsInChapter;
             ++problemNumber)
        {
            if (problemNumber % problemsPerPage == 0)
                ++pageNumber;
            if (problemNumber + 1 == pageNumber)
                ++specials;
        }
    
    cout << specials;
    return 0;
    

    }