Hey guys, here is task number !
As you can see, the name of this is CASHIER.
Plarry the Dinosaur has finally found a job as a cashier! (yay) However, the thing is, he is terrible at mental sum and wants you to write a code to help him in calculating the cost of items.
Input Details:
First line inputs n.
Next n lines input the cost of the ith item.
This line inputs x.
The next x lines are the items the purchaser bought, the number i representing the ith item.
Output Details:
The total cost of all the items.
Sample input:
3
0.25
5.67
10.01
2
3
1
Sample output:
10.26
Explanation for output:
The 1st item costs 0.25 dollars and the 3rd item costs 10.01 dollars. Thus, the total cost is 10.26 dollars.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
My solution in
C++
My solution in
Java
And here is python2 solution below:
sorry ur the only one who tried this daniel XD anyway my solution:
Log in to reply
maybe no one saw this post