--------------------------------------------------------------------------------
题目要求:
现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。
具体的输入输出格式规定如下:
输入格式:测试输入包含若干测试用例。每个测试用例的第1行包含两个正数 Q 和 N,其中 Q 是给定的报销额度,N(<=30)是发票张数。随后是 N 行输入,每行的格式为:
m Type_1:price_1 Type_2:price_2 ... Type_m:price_m
其中正整数 m 是这张发票上所开物品的件数,Type_i 和 price_i 是第 i 项物品的种类和价值。物品种类用一个大写英文字母表示。当N为0时,全部输入结束,相应的结果不要输出。
输出格式:对每个测试用例输出1行,即可以报销的最大数额,精确到小数点后2位。
输入样例:
200.00 3
<chmetcnv w:st="on" unitname="a" sourcevalue="2" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">2 A</span></chmetcnv>:23.50 B:100.00
<chmetcnv w:st="on" unitname="C" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">1 C</span></chmetcnv>:650.00
<chmetcnv w:st="on" unitname="a" sourcevalue="3" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">3 A</span></chmetcnv>:<chmetcnv w:st="on" unitname="a" sourcevalue="59.99" hasspace="True" negative="False" numbertype="1" tcsc="0">59.99 A</chmetcnv>:120.00 X:10.00
1200.00 2
2 B:<chmetcnv w:st="on" unitname="a" sourcevalue="600" hasspace="True" negative="False" numbertype="1" tcsc="0">600.00 A</chmetcnv>:400.00
<chmetcnv w:st="on" unitname="C" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">1 C</span></chmetcnv>:200.50
1200.50 3
2 B:<chmetcnv w:st="on" unitname="a" sourcevalue="600" hasspace="True" negative="False" numbertype="1" tcsc="0">600.00 A</chmetcnv>:400.00
<chmetcnv w:st="on" unitname="C" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">1 C</span></chmetcnv>:200.50
<chmetcnv w:st="on" unitname="a" sourcevalue="1" hasspace="True" negative="False" numbertype="1" tcsc="0"><span style="font-size: 10pt; font-family: Verdana;" lang="EN-US">1 A</span></chmetcnv>:100.00
100.00 0
输出样例:
123.50
1000.00
1200.50
-------------------------------------------------------------------------











































