Question: * please do not use AI to generate the answer In Taiwan's receipt lottery, each receipt number consists of 8 digits . For each drawing,

*please do not use AI to generate the answer
In Taiwan's receipt lottery, each receipt number consists of 8digits. For each drawing, there is one special prize number and three first prize numbers. The prizes are awarded based on the following rules:
Special Prize: If the 8-digit number matches the special prize number exactly, the prize is 2,000,000NTD.
First Prize: If the 8-digit number matches any of the three first prize numbers exactly, the prize is 200,000NTD.
Second Prize: If the last 7digits of the number match the last 7digits of any first prize number, the prize is 40,000NTD.
Third Prize: If the last 6digits of the number match the last 6digits of any first prize number, the prize is 10,000NTD.
Fourth Prize: If the last 5digits of the number match the last 5digits of any first prize number, the prize is 4,000NTD.
Fifth Prize: If the last 4digits of the number match the last 4digits of any first prize number, the prize is 1,000NTD.
Sixth Prize: If the last 3digits of the number match the last 3digits of any first prize number, the prize is 200NTD.
If a receipt qualifies for multiple prizes, only the prize with the highest value is awarded.
Write a program to calculate the total prize money for a list of receipt numbers. The program should validate the receipt numbers and only process those that are valid (exactly 8-digit numbers).Input Description:
Special Prize and First Prize Numbers:
special =["78574302"]
heads =["93757765","21588638","69224926"]
Tickets: A list of receipt numbers (the number of tickets is not limited)
Output Description:
Return the total prize amount. If any ticket number is invalid (not an 8-digit number),that ticket will not be processed for prize calculation.
Example:
Input:
special =["78574302"]
heads =["93757765","21588638","69224926"]
tickets =["78574302","84556452","21587638","24926","88574302"]
Output:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!