95. Inventory Value
Core1000 ms256 MBSolved by 0%
Read n inventory records, each holding an item id, a quantity and a unit
price.
Print the total value of the inventory — the sum of quantity × price over every item.
Constraints - `1 ≤ n ≤ 100000` - `0 ≤ quantity ≤ 1000000` - `0 ≤ price ≤ 1000000`
Input
The first line contains an integer n.
Each of the next n lines contains an item id, a quantity and a unit price.
Output
Print one integer — the total value, the sum of quantity times price over every item.
Input2
1 10 50
2 5 100
Output1000
Noteis a small inventory
Input1
1 0 999
Output0
Notehas zero quantity, so the item contributes nothing
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution