1 条题解
-
0
#include<bits/stdc++.h> using namespace std; typedef long long LL; priority_queue<LL,vector<LL>,greater<LL> > q; int main(){ ios::sync_with_stdio(0); LL n; cin>>n; for(LL i=1;i<=n;i++){ LL x; cin>>x; q.push(x); } while(q.size()>1){ LL x=q.top();q.pop(); LL y=q.top();q.pop(); if(x!=y) q.push(y); else q.push(x+y); } cout<<q.top(); return 0; }
- 1
信息
- ID
- 52
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- (无)
- 递交数
- 16
- 已通过
- 3
- 上传者