求本题的正解
  • 板块灌水区
  • 楼主cypher_cat_
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/8/15 17:20
  • 上次更新2023/11/3 03:35:40
查看原帖
求本题的正解
1058036
cypher_cat_楼主2023/8/15 17:20

P2094

我的代码没法通过 hack 数据

#include<bits/stdc++.h>
using namespace std;
int n,k;
priority_queue<int> a;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int tmp;
		cin>>tmp;
		a.push(tmp);
	}
	int t1,b;
	for(int i=1;i<n;i++){
		t1=a.top();
		a.pop(); 
		b=t1+a.top();
		a.pop();
		a.push(b/k);
	}
	cout<<a.top()<<endl;
	return 0;
}
2023/8/15 17:20
加载中...