Вопрос задан 25.11.2023 в 17:08. Предмет Информатика. Спрашивает Логинов Даниил.

№ 1 Пакеты для покупок Пакет для покупок выдерживает m грамм. Один йогурт весит k грамм.

Определите, сколько пакетов понадобиться при покупке n йогуртов, если не перегружать пакеты относительно разшенной массы в m грамм. Решите задачу без использования условной инструкции, ее аналогов, вещественной арифметики, а также циклов. Формат входных данных В первой строке вводится значение m (1000⩽m⩽100000 ). Во второй строке вводится значение k (1⩽m⩽1000 ). В третьей строке вводится значение n (0⩽m⩽1000 ). Формат выходных данных Выведите одно число — количество необходимых для покупки пакетов. Ввод Вывод 1000 900 10 10 1000 500 3 2 Ограничения Время выполнения: 1 секунда Процессорное время: 1 секунда Память: 256 MB
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Житникова Юлия.

1)

m = int(input())

k = int(input())

n = int(input())

m1 = m // k

n1 = n // m1 + (n % m1 > 0)

print(n1)

2)

from math import ceil

m = int(input())

k = int(input())

n = int(input())

m1 = m // k

n1 = ceil(n / m1)

print(n1)

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To solve this problem, we need to determine how many packets are needed to carry a certain number of yogurts without overloading the packets. Let's break down the problem step by step.

Step 1: Input the values

We are given three values as input: - The maximum weight a packet can hold, denoted by m (1000 ≤ m ≤ 100000). - The weight of one yogurt, denoted by k (1 ≤ k ≤ 1000). - The number of yogurts to be purchased, denoted by n (0 ≤ n ≤ 1000).

For example, if we have the following input: ``` 1000 900 10 ```

Step 2: Calculate the number of packets needed

To calculate the number of packets needed, we can divide the total weight of the yogurts by the maximum weight a packet can hold. However, we need to make sure not to overload the packets.

To avoid overloading, we can use integer division to calculate the number of packets needed. Integer division discards the remainder and only returns the whole number part of the division.

The formula to calculate the number of packets needed is: ``` number_of_packets = (n * k) // m ```

For example, using the input values from Step 1: ``` number_of_packets = (10 * 900) // 1000 = 9000 // 1000 = 9 ```

Therefore, 9 packets are needed to carry 10 yogurts without overloading the packets.

Step 3: Output the result

The final step is to output the number of packets needed.

For example, using the input values from Step 1, the output would be: ``` 9 ```

Therefore, the answer to the problem is 9.

Please note that this solution does not involve the use of conditional statements, real arithmetic, or loops, as specified in the problem statement.

Let me know if you have any further questions!

0 0

Похожие вопросы

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос