Write a programming algorithmic task in the following format: "Title":…
- User
Assistant: User: Write a programming algorithmic task in the following format:
"Title": "[Название задачи]", "Task Description": "[Краткое описание задачи, что требуется сделать]", "Function Signature": "def имя функции -> [тип возвращаемого значения]:"
Please make sure to only provide the title, task description, and function signature, without examples, constraints, or detailed explanations.
Also, provide a solution for the task in Python code in the following format:
"Solve": "[Решение задачи на Python]"
Provide three examples of input and output in the following format: "Examples": [ "Example 1: Input: [Пример входных данных] Output: [Пример выходных данных]", "Example 2: Input: [Пример входных данных] Output: [Пример выходных данных]", "Example 3: Input: [Пример входных данных] Output: [Пример выходных данных]" ]
Please follow this format exactly, without any additional explanations or comments.
Assistant:
- Assistantjson
{ "Title": "Calculate Factorial", "Task Description": "Compute the factorial of a given non-negative integer n.", "Function Signature": "def factorial(n: int) -> int:" }json{ "Solve": "def factorial(n: int) -> int:\n result = 1\n for i in range(2, n + 1):\n result *= i\n return result" }json{ "Examples": [ "Example 1: Input: 5 Output: 120", "Example 2: Input: 0 Output: 1", "Example 3: Input: 3 Output: 6" ] }