Tap here to switch tabs
Problem
Submissions

Problem: Minimum Cost to Split into Ones

Minimum Cost to Split into Ones starts with one integer and repeatedly splits values greater than one into two positive parts, paying the product. Return the least total cost until all values are one.

Statement

You are given an integer n. Starting with a single integer n, you repeatedly perform operations until all remaining values are equal to 11.

In one operation, you can select any current integer x that is strictly greater than 11 and split it into two positive integers a and b such that a ++ b == x. The cost of performing this split is a $ imes$ b.

Return the minimum total cost required to split n into all ones.

Constraints:

  • 1≤1 \leq n ≤500\leq 500

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Cost to Split into Ones

Minimum Cost to Split into Ones starts with one integer and repeatedly splits values greater than one into two positive parts, paying the product. Return the least total cost until all values are one.

Statement

You are given an integer n. Starting with a single integer n, you repeatedly perform operations until all remaining values are equal to 11.

In one operation, you can select any current integer x that is strictly greater than 11 and split it into two positive integers a and b such that a ++ b == x. The cost of performing this split is a $ imes$ b.

Return the minimum total cost required to split n into all ones.

Constraints:

  • 1≤1 \leq n ≤500\leq 500