formatting source-code for 153fb7b8a5

This commit is contained in:
github-actions
2020-05-30 04:02:09 +00:00
parent 92fe9495ec
commit 8a2de9842b
175 changed files with 1671 additions and 3460 deletions

View File

@@ -5,23 +5,19 @@ the pieces.*/
#include <iostream>
using namespace std;
int cutrod(int p[], int n)
{
int cutrod(int p[], int n) {
int r[n + 1];
r[0] = 0;
for (int j = 0; j < n; j++)
{
for (int j = 0; j < n; j++) {
int q = INT_MIN;
for (int i = 0; i <= j; i++)
{
for (int i = 0; i <= j; i++) {
q = max(q, p[i] + r[j - i]);
}
r[j + 1] = q;
}
return r[n];
}
int main()
{
int main() {
int price[] = {1, 5, 8, 9, 10, 17, 17, 20, 24, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
cout << cutrod(price, 30);