
С++ 100 БАЛЛОВ!!БЕЗ ЦИКЛОВ, If, == (операторов сравнения)!!! Настольный тенниcФеофилакт хочет
купить ракетки и шарики для игры в настольный теннис. Один комплект ракеток стоит A рублей, один шарик стоит B рублей. У Феофилакта есть C рублей, C≥A, он покупает один комплект ракеток и шарики на оставшиеся деньги. Сколько шариков купит Феофилакт?Входные данныеПрограмма получает на вход три натуральных числа: A, B, C, не превосходящих 2⋅109.Выходные данныеПрограмма должна вывести ответ на задачу.ПримерыВвод201055Вывод3

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

begin
println('Введите стоимость комплекта ракеток(А) и Шарика(B)');
var (a,b) := ReadInteger2('A, B:');
var c := ReadInteger('Наличные:');
assert(c >= a);
print(Trunc((c - a) / b), 'Шр.')
end.



Problem Analysis
To solve this problem, we need to determine how many table tennis balls Feofilakt can buy with the remaining money after purchasing one set of rackets. The cost of one set of rackets is A rubles, the cost of one ball is B rubles, and Feofilakt has C rubles. We need to find out how many balls he can buy with the remaining money after purchasing the rackets.Solution
We can solve this problem using simple arithmetic operations without using loops or comparison operators.We can calculate the number of balls Feofilakt can buy by first finding the cost of one set of rackets and then subtracting it from the total amount of money he has. After that, we can divide the remaining amount by the cost of one ball to find out how many balls he can buy.
Let's denote the number of rackets as X and the number of balls as Y. We can use the following formula to calculate the number of balls: Y = (C - A) / B
Code Implementation
```python def calculate_balls_cost(A, B, C): # Calculate the number of balls Feofilakt can buy balls = (C - A) // B return balls# Input values A = 20 B = 10 C = 55
# Calculate the number of balls Feofilakt can buy result = calculate_balls_cost(A, B, C) print(result) # Output: 3 ```
Explanation
In the given example, Feofilakt has 55 rubles, and one set of rackets costs 20 rubles. After purchasing the rackets, he has 55 - 20 = 35 rubles left. Since one ball costs 10 rubles, he can buy 35 / 10 = 3 balls with the remaining money.Therefore, Feofilakt can buy 3 balls with the remaining money after purchasing one set of rackets.


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








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