比赛 |
20160419s |
评测结果 |
AAAAAAAAAA |
题目名称 |
扑克游戏 |
最终得分 |
100 |
用户昵称 |
mikumikumi |
运行时间 |
0.020 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2016-04-19 11:06:03 |
显示代码纯文本
- #include<cstdio>
- #include<queue>
- #include<iostream>
- using namespace std;
- const int SIZEN=10010;
- priority_queue<int,vector<int>,greater<int> > Q;
- int N;
- void read()
- {
- scanf("%d",&N);
- int a;
- for(int i=1;i<=N;i++)
- {
- scanf("%d",&a);
- Q.push(a);
- }
- }
- void work()
- {
- int ans=0;
- while(Q.size()>1)
- {
- int x=Q.top();Q.pop();
- int y=Q.top();Q.pop();
- int tem=x+y;
- ans+=tem;
- Q.push(tem);
- }
- printf("%d\n",ans);
- }
- int main()
- {
- freopen("poker.in","r",stdin);
- freopen("poker.out","w",stdout);
- read();
- work();
- return 0;
- }