[第1章 1.5t1] 合并果子
#include#define endl '\n' using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false);cin.tie(0); ll n; cin>>n; priority_queue ,greater<>> a; for(ll i=0;i >tmp; a.push(tmp); } ll ans=0; while(a.size()>1){ ll aa=a.top();a.pop(); ll bb=a.top();a.pop(); ans+=aa+bb; a.push(aa+bb); } cout<

浙公网安备 33010602011771号