cswork / OA打开练习工作台

CitadelOA #22

Price Check

估计简单评测数据准备中,可先阅读题面

考点(AI 标注)哈希计数

There is a shop with old-style cash registers. Rather than scanning items and pulling the price from a database, the price of each item is typed in manually. This method sometimes leads to errors. Given a list of items and their correct prices, compare the prices to those entered when each item was sold. Determine the number of errors in selling prices. Function Description Complete the function priceCheck in the editor. priceCheck has the following parameter(s):

    1. String[] products: each products[i] is the name of an item for sale
    1. float[] productPrices: each productPrices[i] is the price of products[i]
    1. String[] productSold: each productSold[i] is the name of a product sold
    1. float[] soldPrice: each soldPrice[i] contains the sale price recorded for productSold[i] Returns int: the number of sale prices that were entered incorrectly

Constraints

  • 1 ≤ n ≤ m
  • 1 ≤ m ≤ n
  • |SP - productPrices[i], soldPrice[j]| ≤ 100000.00, where `0 ≤ i