IPL: THE RUN CHASE
I was recently watching a IPL T20 match on Youtube. It was Kings-XI vs. Kolkata Knight Riders.
The highlight of the match was when Chris Gayle got going and hauled 5 consecutive sixes in an over. What was amazing was the ease with which he was timing the ball. He was simply hitting the ball wherever he wanted around the stadium. Spin, pace, line, length… nothing mattered. Once the bowler delivered the ball, Gayle used to simply make contact in one fluid motion, and the ball would launch as if it suddenly had fired-up rocket boosters and continued flying skywards out of the stadium…
This happened not once or twice… BUT 5 TIMES IN A ROW!!
But it was not for long. Pity he got out trying to haul one over long-off in the next over.
It reminded me of that one over by Chris Broad in which Yuvraj Singh smashed 6 sixes of 6 balls continuously.
|| Yuvraj Singh : 6 sixes in 6 balls ||
The way batsmen can pound and smash away on a good day kind of got me wondering. What if some day batsmen are able to score at will. If one is chasing a big score and can score at will. What is the best way to chase the target. In other words, given a target of N runs and x balls to achieve it, what is the least risky way to achieve the target?
IPL Problem No.1 : THE RUN CHASE
1. Assume you can score exactly as you want on each ball.
2. Single/Double/Triple/Four/Six are the options available to you.
3. RISK is defined as the square of the score on each ball.
* * * *
Write a program that accepts:-
a. Target runs to score (N)
b. No. of balls to score it in (x)
and prints the runs to score on each ball.
Remember U have to ACHIEVE the target with MINIMUM RISK possible.
Here’s a sample :
Scoring: 2 2 3 3 3 3
(order is not important i.e. 2 3 3 2 3 3 is right too)
Risk involved: 44 << This should be minimum possible.
(calculated using the table above)
4 triples i.e. 4 * 9 = 36
2 doubles i.e. 2 * 4 = 8
Total RISK = 36 + 8 = 44
NOTE: A basic understanding of runs in CRICKET could be helpful. 😉
Post in ur code/algorithm/analyses as the comments below. Good Luck!!
Checkout the Hall-of-FAME.