开始 2024-08-19 00:00:00

8.19-8.24集训第一天

结束 2024-08-25 23:59:00
Contest is over.
当前 2024-12-22 13:55:48

紧急集合

include

include

define pt p.top();

define pp p.pop();

define pu(a) p.push(a);

using namespace std; int n,i,x,y,ans; priority_queue<int,vector,greater > p; int main() {

scanf("%d",&n);
for(i=1;i<=n;i++)
{
	scanf("%d",&x);
	p.push(x);
}
while(p.size()!=1)
{
	x=pt
	pp
	y=pt
	pp
	ans+=x+y;
	p.push(x+y);
}
printf("%d",ans);
return 0;

}


xiezj  •  4个月前

include

include

define pt p.top();

define pp p.pop();

define pu(a) p.push(a);

using namespace std; int n,i,x,y,ans; priority_queue<int,vector,greater > p; int main() {

scanf("%d",&n);
for(i=1;i<=n;i++)
{
	scanf("%d",&x);
	p.push(x);
}
while(p.size()!=1)
{
	x=pt
	pp
	y=pt
	pp
	ans+=x+y;
	p.push(x+y);
}
printf("%d",ans);
return 0;

}


xiezj  •  4个月前

比赛已结束。