Challenge: Combo Meal
Subdomeniu: Algebra (algebra)
Scor cont: 15.0 / 15
Submission status: Accepted
Submission score: 1.0
Submission ID: 464719925
Limbaj: python3
Link challenge: https://www.hackerrank.com/challenges/combo-meal/problem
Cerinta
A fast-food chain menu is selling a burger, a can of soda, and a combo meal containing a burger and a can of soda, at prices known to you.
They have chosen the selling price for each item by first determining the *total cost* of making the individual items and then adding a *fixed* value to it, representing their *profit*. Assume that the cost of making a regular burger is fixed and the cost of making a regular soda is fixed.
For example, if the cost of making a regular burger is $206$, the cost of making a regular soda is $145$ and the fixed profit is $69$, then the fast-food chain will set selling prices as:

Given the price of a burger, a can of soda and a combo meal on the menu, your task is to compute the fixed profit.
Complete the function named `profit` which takes in three integers denoting selling price of a burger, a can of soda and a combo meal respectively, and returns an integer denoting the fixed profit.
Input Format
The first line contains $t$, the number of scenarios. The following lines describe the scenarios.
Each scenario is described by a single line containing three space-separated integers, $b$, $s$ and $c$, denoting how much a burger, a can of soda and a combo meal cost respectively.
Output Format
For each scenario, print a single line containing a single integer denoting the profit that the fast-food chain gets from every purchase. It is guaranteed that the answer is positive.
Constraints
- $1 \le t \le 100$
- $3 \le c \le 2000$
- $2 \le b, s < c$
- It is guaranteed that the cost of making each item and the profit are positive.
Cod sursa
#!/bin/python3
import math
import os
import random
import re
import sys
def profit(b, s, c):
# Return the fixed profit.
return b + s - c
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
t = int(input().strip())
for t_itr in range(t):
first_multiple_input = input().rstrip().split()
b = int(first_multiple_input[0])
s = int(first_multiple_input[1])
c = int(first_multiple_input[2])
result = profit(b, s, c)
fptr.write(str(result) + '\n')
fptr.close()
HackerRank Algebra – Combo Meal
