111,126
社区成员
发帖
与我相关
我的任务
分享
int kp=100;
int he=100;
int nhe=0;
do
{
nhe=kp/2;
he+=nhe;
kp=kp/2+kp%2;
}
while(kp>=2);
printf("%d\n",he);
int nCount = money;
int nResult = 0;
nResult += nCount;
while (nCount > 1)
{
nCount -= 2;
nResult++;
nCount += 1;
}
Console.WriteLine(nResult);
int i = 100; //瓶子数
int sum = 0; //喝到多少瓶水
sum = i;
while (i > 1)
{
sum += i / 2;
i = i % 2 + i / 2;
}
<script type="text/javascript">
var howMuchBottle = 0;
function count(totalMoney) {
var i = 1;
while (i < totalMoney && i != totalMoney) {
howMuchBottle += Math.floor(totalMoney / i);
i *= 2;
}
return howMuchBottle++;
}
alert(count(20));
</script>