
Вопрос задан 26.02.2019 в 07:50.
Предмет Информатика.
Спрашивает Дорошенко Вероника.
Расстояние от города до деревни а км. Пройдет ли турист это расстояние за 8ч, если будет идти со
скоростью b км/ч? c++ Input: а и b Output: Вывести "Yes"- если пройдет турист это расстояние за 8ч, иначе "No". Samples: Input-1: 36 4 Output-1: No Input-2: 36 5 Output-2: Yes

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

Отвечает Вашкевич Александра.
#include <iostream>
int main()
{
int a, b;
std::cin >> a >> b;
std::cout <<(a <= 8*b?"Yes":"No");
return 0;
}
int main()
{
int a, b;
std::cin >> a >> b;
std::cout <<(a <= 8*b?"Yes":"No");
return 0;
}



Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.
Problem Analysis
We are given the distance from a city to a village, denoted by 'a' kilometers. We need to determine if a tourist can cover this distance in 8 hours, given that they are walking at a speed of 'b' kilometers per hour. We need to output "Yes" if the tourist can cover the distance in 8 hours, and "No" otherwise.Solution
To solve this problem, we need to calculate the time it would take for the tourist to cover the distance 'a' kilometers at a speed of 'b' kilometers per hour. If the calculated time is less than or equal to 8 hours, we output "Yes"; otherwise, we output "No".The formula to calculate time is: time = distance / speed
Let's implement this solution in code:
```python a, b = map(int, input().split()) time = a / b
if time <= 8: print("Yes") else: print("No") ```
Example
Let's consider the first sample input: `36 4`. In this case, the distance is 36 kilometers and the speed is 4 kilometers per hour. Using the formula, we can calculate the time as follows: time = 36 / 4 = 9 hoursSince the calculated time is greater than 8 hours, the output will be "No".
For the second sample input: `36 5`, the time can be calculated as: time = 36 / 5 = 7.2 hours
Since the calculated time is less than or equal to 8 hours, the output will be "Yes".
Conclusion
In this problem, we determined whether a tourist can cover a given distance in 8 hours, given their walking speed. We used the formula time = distance / speed to calculate the time it would take for the tourist to cover the distance. Based on the calculated time, we output "Yes" if the time is less than or equal to 8 hours, and "No" otherwise.

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