Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add solution of Ladders E-Olymp (dynamic programming) #199

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ <h1 class="animated rubberBand delay-4s">Contributors</h1>
<a class="box-item" href="https://github.com/akash-10-23"><span>Akash Ratan Verma</span></a>
<a class="box-item" href="https://github.com/ana2407"><span>Vibhuti Negi</span></a>
<a class="box-item" href="https://github.com/ananya2407"><span>Ananya Sajwan</span></a>
<a class="box-item" href="https://github.com/husinassegaff"><span>Husin Muhammad Assegaff</span></a>

</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Solution of problem Ladders - E-Olymp (https://www.e-olymp.com/en/problems/989)

#include <cstdio>
using namespace std;

int n, dp[100];

int main()
{
scanf("%d", &n);
dp[0] = 1;
for (int i = 1; i <= n; i++)
{
for (int j = n; j >= 0; j--)
{
if (i + j <= n)
dp[j + i] += dp[j];
}
}
printf("%d\n", dp[n]);
}