Tap here to switch tabs
Problem
Submissions

Problem: Clumsy Factorial

med
30 min
Try to solve the Clumsy Factorial problem.

Statement

The factorial of a positive integer n is the product of all positive integers less than or equal to n.

A clumsy factorial uses integers in decreasing order from n down to 11, applying four arithmetic operations in a fixed rotating sequence: multiplication (*), division (/), addition (+), and subtraction (-).

Standard arithmetic operator precedence applies: multiplication and division are computed before addition and subtraction, and operations of the same precedence are evaluated from left to right. Division uses floor division, rounding down to the nearest integer.

Given an integer n, return the clumsy factorial of n.

Constraints:

  • 1≤1 \leq n ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Clumsy Factorial

med
30 min
Try to solve the Clumsy Factorial problem.

Statement

The factorial of a positive integer n is the product of all positive integers less than or equal to n.

A clumsy factorial uses integers in decreasing order from n down to 11, applying four arithmetic operations in a fixed rotating sequence: multiplication (*), division (/), addition (+), and subtraction (-).

Standard arithmetic operator precedence applies: multiplication and division are computed before addition and subtraction, and operations of the same precedence are evaluated from left to right. Division uses floor division, rounding down to the nearest integer.

Given an integer n, return the clumsy factorial of n.

Constraints:

  • 1≤1 \leq n ≤104\leq 10^4