一个的小偷Muthhooswamy计划Tihar监狱逃跑。 muthhooswamy基本上是一个猴子的人,他能跃过墙。他练穿过墙壁,他是能够跳出"X"米,但因为湿滑的墙壁,他属于"Y"米后每跳。从监狱逃跑,他有过"N"每个墙的高度是在一个数组的墙壁。写一个程序,找出跳跃的总数,他从监狱逃跑。
| vdkolekar#include <iostream>
#include <string.h>
#include<conio.h>
void GetJumpCount(int climbUp,int climbDown,int noOfWalls,int wallHeights[])
{
int clu,cld,now,n,count;
count=0;
clu=climbUp;
cld=climbDown;
now=noOfWalls;
//wh[]=wallHeights[];
n=lenghtof.wallHeights[];
for(int i=0;i<n;i++)
{
int ht=0,temp=0;
ht=wallHeights[i];
while(ht<(temp=clu-cld))
{
if(temp>ht)
{
count++;
break;
}
else
count++;
}
}
cout<<count;
}
void main()
{
clrscr();
GetJumpCount(10,1,1{10});
getch();
}