Вопрос задан 14.11.2023 в 23:29. Предмет Информатика. Спрашивает Кириенко Михаил.

Скорость машины n в день. Сколько дней нужно, чтобы проехать маршрут длиной m километров? Программа

получает на вход в первой строке натуральное число n и во второй строке целое неотрицательное число m. Решить через питон или паскаль
0 0
Перейти к ответам

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

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

int(input("скорость машины в день=", n)

int(input("длина маршута=", m)

x=m/n

print("машине понадобится", x, "дней"

ето на Пайтоне

(думаю правильно)

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

The question you asked is:

Answer in detail. The speed of the car is n per day. How many days does it take to travel a route of length m kilometers? The program receives a natural number n in the first line and a non-negative integer m in the second line. Solve using python or pascal.

The answer is:

To solve this problem, we need to find the number of days that the car needs to travel a distance of m kilometers, given that it travels at a constant speed of n kilometers per day. We can use the formula:

days = m / n

However, since the number of days must be an integer, we need to round up the result to the nearest whole number. This means that we need to add 1 to the result if the remainder of m / n is not zero. We can use the modulo operator (%) to check the remainder. The final formula is:

days = (m / n) + (m % n != 0)

This formula works for both python and pascal, as long as we use integer division (/) and not floating-point division (// in python, / in pascal).

Here is an example of how to implement this formula in python:

n = int(input()) # read n from the first line m = int(input()) # read m from the second line days = (m / n) + (m % n != 0) # calculate the number of days print(days) # print the answer

Here is an example of how to implement this formula in pascal:

var n, m, days: integer; begin readln(n); // read n from the first line readln(m); // read m from the second line days := (m div n) + ord(m mod n <> 0); // calculate the number of days writeln(days); // print the answer end.

You can also find some similar problems and solutions on the web . I hope this helps you understand the problem and the solution.

0 0

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

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

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

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