# (SOLVED) Code in Python pleasee

Discipline: IT, Web

Paper Format: APA

Pages: 1 Words: 275

Question

TTBank has gift cards, and they come in three different denominations: \$10, \$30, and \$50. Jugg has collected a lot of them!

Jugg would like to use N cards to buy an item, which costs M dollars. However, he doesn't want to leave a remaining balance on any cards he chooses.

How many different ways is Jugg able to buy the item?

Input Format

The first line contains two integers N, M. N is the number of cards, and M is the cost of that item.

Output Format

An integer, representing the number of different ways to buy the item, using the exact number of cards required.

Sample Input

480

Sample Output

2

Explanation

Jugg must use 4 cards to buy an \$80 item.

There are 2 ways to do this:

# Define the denominations of the gift cards
denominations = [10, 30, 50]

# Read the number of cards and the cost of the item from the input
n, m = map(int, input().split())

# Initialize a counter to keep track of the number of ways
# to buy the item using the exact number of cards
counter = 0

# Iterate over all possible combinations of cards
for a in range(n+1):
for b in range(n+1):
for c in range(n+1):
# Check if the number of cards of each denomination is valid
if a + b + c == n:
# Check if the total cost of the item can be paid using the cards
if a*denominations + b*denominations + c*denominations == m:
# If both conditions are satisfied, increment the counter
counter += 1

# Print the result
print(counter)

Here I Have attach the Output for the code : 