Logo
(追記) (追記ここまで)

10184번 - Coupon2 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB74423960.000%

문제

When you go shopping and have coupons, you can only get discounts on the items you actually purchased. Before UPC codes and scanners, it was up to the cashier to check for purchases and to verify if the coupons were for valid purchases. Here is some information on UPC codes:

(http://cdn.vouchercodes.ca/wp-content/uploads/2012/05/anatomy-of-a-upc.jpg)

In this program, you will have a receipt showing the UPC codes and prices. Then you will be given a list of coupons with UPC code and discount. Apply the discount to valid purchases. The UPC codes will be a 12 digit numeric sequence and the price will have no dollar sign on input.

입력

The first line consists of the number of data sets. The first line in each data set will consist of X and Y, the number of purchases and number of coupons. The first X lines of each data set consist of the UPC code and the price. The next Y lines consist of the UPC code and the decimal of the discount (0.20 = 20% off). X and Y will be at least 1 and at most 20, with Y <=X.

출력

For each data set, print out the total of the purchases. If there are invalid coupons on the purchase, print out “INVALID COUPONS” on the next line followed by the UPC codes of the invalid coupons, each on one line.

제한

예제 입력 1

3
1 1
000000123456 19.99
000000123456 0.10
5 2
000000123456 19.99
000000123457 10.00
000000123458 20.00
000000123459 30.00
000000123460 40.00
000000123456 0.10
000000123459 0.20
5 2
000000123456 19.99
000000123457 10.00
000000123458 20.00
000000123459 30.00
000000123460 40.00
000000123456 0.10
000000999999 0.20

예제 출력 1

17.99
111.99
117.99
INVALID COUPONS
000000999999

힌트

출처

School > PLU High School Programming Contest > PLU 2014 > Advanced 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /