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

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

int(input("скорость машины в день=", n)
int(input("длина маршута=", m)
x=m/n
print("машине понадобится", x, "дней"
ето на Пайтоне
(думаю правильно)



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.


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









Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili