a087: Uniform invoice lottery 統一發票對獎
標籤 :
通過比率 : 100% (1 人 / 1 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2021-04-08 09:37

內容

Problem Description:

There are eight digits in the unified invoice number, and one special prize number and three first prize numbers will be issued in each issue.

The special prize is $2 million for the 8-digit number that is the same as the special prize number.

The first prize is $200,000 for an 8-digit number that is the same as the first prize number.

The second prize is $40,000 for each winner, the last 7 digits of the number match the last 7 digits of the first prize number.

The third prize is $10,000 for each winner, the last 6 digits of the number match the last 6 digits of the first prize number.

The fourth prize is $4,000 for each winner, the last 5 digits of the number match the last 5 digits of the first prize number.

The fifth prize is $1,000 for each winner, the last 4 digits of the number are identical to the last 4 digits of the first prize number.

The sixth prize is $200 for each winner, the last 3 digits of the number are identical to the last 3 digits of the first prize number.

Assuming that all prizes are given priority to the larger amount of winnings, please write a simulated prize matching program. It can read in the lottery numbers and unified invoice numbers, print out the type and number of winning prizes, and the total amount of winnings.

 

問題描述 :

統一發票號碼共有八位數,每期開出一組特獎號碼和三組頭獎號碼。

特獎為8 位數號碼與特獎號碼相同者,獎金 200 萬元。

頭獎為8 位數號碼與頭獎號碼相同者,獎金 20 萬元。

二獎為末 7 位數號碼與頭獎號碼末 7 位相同者,各得獎金 4 萬元。

三獎為末 6 位數號碼與頭獎號碼末 6 位相同者,各得獎金 1 萬元。

四獎為末 5 位數號碼與頭獎號碼末 5 位相同者,各得獎金 4 千元。

五獎為末 4 位數號碼與頭獎號碼末 4 位相同者各得獎金 1 千元。

六獎為末 3 位數號碼與頭獎號碼末 3 位相同者各得獎金 2 百元。

假設所有獎項均以中獎金額較大的優先,請寫一模擬對獎程式,讀入開獎號碼及統一發票號碼,印出中獎種類及張數,以及中獎總金額。

 

輸入說明

Input:

The first line is an 8-digit integer representing the special prize lottery number. In the next three lines, each line is an 8-digit integer representing the first prize lottery number. The fifth line is a positive integer N (1 ≤ N ≤ 100000 ), representing a total of N invoices To be rewarded, there are N lines after that, each line is an invoice number (8-digit integer).

輸入說明 :

第一行為一8位整數表示特獎開獎號碼,接下來有三行,每行為一8位整數代表頭獎開獎號碼,第五行為一正整數N( 1 ≤ N ≤ 100000 ),代表共有N張發票要對獎,之後有N行,每行為一張發票號碼(8位整數)。

輸出說明

Output:

Output the number of prizes for each award in a row, where the prizes are arranged in order, starting from the special prize. There is a blank space between the numbers of prizes, and the total amount of winnings will be output after the last empty row.

輸出說明 :

輸出各獎項之中獎張數於第一行,自特獎開始,獎項依序排列,獎項中獎張數間空一空格;最後空一行後輸出總共中獎金額。

 

 

範例輸入
14672884
79807980
85312452
94251069
3
79807980
84556452
15661069 
範例輸出
0 1 0 0 0 1 1
201200
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (100%): 1.0s , <1K
提示 :
標籤:
出處:
[編輯 :
shengZJ (shengZJ)
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」