Skip to main content

Featured

Dhadi Game - An Indian War game

Hi Friends, Today i will introduce an indian traditional board game to android user I am very interested in playing dhadi game with my friends. Now that interest  becomes as an android game Here these are the playing instructions to the dhadi game Dhadi is a traditional indian game with two players.It runs with mind power between 2 players.You can play against your friends Features: Auto Move Suggestions Interesting Graphic View to game Time taken by two players will be shown individually Total movements shows Intresting background sounds and music music and sound on/off feature No permissions are needed to this app. Download the best Dhadi for Android now! https://play.google.com/store/apps/details?id=in.mjtech.daddy

program to find out the total number of jumps he will make to escape from the jail

your friend planned to escape from Tihar jail. He is basically a monkey man and he is able to jump across the wall. He practiced to cross a wall and he is able to jump 'X' meters, but because of slippery wall he fall 'Y' meters after each jump. To escape from jail he has to cross 'N' number of walls where height of each wall is given in an array. Write a program to find out the total number of jumps he will make to escape from the jail.

input specification:
1.distance up in meter
2.distance slipped in meter
3.store the height of the wall in an array

[sourcecode language="python" wraplines="false" collapse="false"]

<?php
function getjumps($x=0,$y=0,$z=array()){
$r=0;
if(count($z)>0){
if($x>$y){
foreach($z as $a){
$b=floor($a/($x-$y));
if(($a-($b-1)*($x-$y))<=$x){
$r+=$b;
}else{
$r+=$b+1;
}
}
}
}
return $r;
}
echo getjumps(7,3,[21,16,32]);
?>

[/sourcecode]

output:17

Comments

Popular Posts