ac

lyhan · 发布于 2023-07-21 · 浏览 457 回复 0

include <bits/stdc++.h>

using namespace std; int main() {

int v,h,a;
int b=1,c=0;
cin>>v>>h;
while(h>0&&v>0)
{
	for(int i=b;i>0&&h>0;i--)
	{
		v=v-h;
		c++;
		if(v<=0)
		{
			break;
		}
	}
	h=h/2;
	b++;
}
if(v<=0)
{
	cout<<c;
}
else
{
	cout<<v;
}
return 0;

}

全部回复 共 0 条

还没有人回复。往下写第一条。

发表回复