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
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.