#K62367. Energy Consumption Statistics

    ID: 31516 Type: Default 1000ms 256MiB

Energy Consumption Statistics

Energy Consumption Statistics

You are given a series of device logs where each log contains the name of a device and its energy consumption in watts. Your task is to compute two things:

  1. The average energy consumption rounded to two decimal places. This is defined as (\frac{\text{total energy consumption}}{n}) where (n) is the number of devices.
  2. The name of the device with the highest energy consumption. In case of a tie, choose the device that appears first in the input.

For example, if the input contains 3 devices: Laptop (150 watts), TV (200 watts), and Fridge (300 watts), then the average energy consumption is (\frac{150+200+300}{3} = 216.67) and the device with the highest consumption is Fridge.

inputFormat

The input is read from standard input (stdin). The first line contains an integer (n) representing the number of device logs. This is followed by (n) lines, each containing a device name (a string without spaces) and an integer representing its energy consumption in watts, separated by space.

outputFormat

Output to standard output (stdout) a single line containing the average energy consumption (rounded to two decimal places) and the name of the device with the highest energy consumption, separated by a space.## sample

3
Laptop 150
TV 200
Fridge 300
216.67 Fridge

</p>