-2
$\begingroup$

I am not able to understand below problem, mainly the example. I have tried to ask explanation in their website but not received help yet.

how they are calculating 36 and 43? and why 36+43 = 30$ is written?

Can I get a diagram visualizing this, because I think wood cutter should cost 12$ because only 3*4 area is needed.

Practice Problem on HackerEarth:-

Ad-optimization team is moving to their new office Safina Towers :) . But the problem is Safina towers don't have furniture, but you have wood-sheet. You are given a wood-sheet of length L . Since everyone wants to create their desk in their own style you have to give them some amount of wood. So, you are given N mark-down points (since ad-optimization team have n members) from that points you have to cut the wood sheet. But the problem is wood-cutter will cost (Xleft) + (Y right) for cutting the wood (where left and right is the size of the remaining parts of the wood after cutting). For example you want to cut a wood sheet of length 10 and X=3 and Y=4 and you want to cut at point 7 then left segment size = (7-1) =6 and right segment size = (10-7) = 3 then wood cutter will cost 36+43 = 30$ .

Question Link

$\endgroup$
  • 1
    $\begingroup$ What is your question? $\endgroup$ – Raphael Nov 16 '17 at 12:36
  • $\begingroup$ how they are calculating 36 and 43? and why 36+43 = 30$ is written? $\endgroup$ – Harish Gyanani Nov 16 '17 at 12:43
  • $\begingroup$ It's not 36 and 43. It should be $3\times6+4\times3$. That's 30. Now can you figure where they got those numbers? $\endgroup$ – Rick Decker Nov 16 '17 at 12:48
  • $\begingroup$ @RickDecker I believe you are right, I have edited the question so that I can understand it completely and code for it. Thanks in advance $\endgroup$ – Harish Gyanani Nov 16 '17 at 13:05
2
+50
$\begingroup$

Most simple explanation: The problem has been written down at hackerearth in some markup "language" not mastered by the author. Multiplication has been denoted using an asterisk * instead of a multiplication sign × (regrettably common since the introduction of type-writers). The markup seems to define that as a toggle between "normal" and "stand-out" text modes: there is a multiplication sign missing everywhere the text alternates between standard and italics. My stab at correction:

Ad-optimization team is moving to their new office Safina Towers :). But the problem is Safina towers don't have furniture: You are given a wood-sheet of length L. Since everyone wants to create their desk in their own style you have to give them some amount of wood. So, you are given N mark-down points (since ad-optimization team has N members). From that points you have to cut the wood sheet. But the problem is wood-cutter will cost (X×left) + (Y×right) for cutting the wood (where left and right is the size of the remaining parts of the wood after cutting).
For example you want to cut a wood sheet of length 10 and X=3 and Y=4 and you want to cut at point 7 then left segment size = (7-1) = 6 and right segment size = (10-7) = 3 then wood cutter will cost 3×6+4×3 = 30.

As Amazonian you have to follow frugality leadership principal, you want to give wood cutter a minimum amount of money and want to cut wood-sheet from every marking point between 1 to L (exclusive). please note that in all the test case first mark point=1 and last mark point = size of sheet (L). Please output minimum amount of money needed for every test case.

Input Format: T: number of test cases (1≤T≤5) For each test case:

First line contains X and Y. (X: multiplier for left segment, Y: multiplier for right segment)
2≤X≤100 2≤Y≤100

Second line Contains N: Number of marking points (2≤N≤100)

Third line contains marking point : m(0), m(1) … , m(n-1) marking points on wood sheet, where m(0)=1, m(n-1)=L and 2≤L≤200000

Output: For each test case : Minimum amount of money you have to pay to wood cutter. Each test case answer must be printed on a new line.

$\endgroup$
  • $\begingroup$ Said author probably is as much a native speaker of English as I am. $\endgroup$ – greybeard Nov 21 '17 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.