0pts全TLE(1.00s)
查看原帖
0pts全TLE(1.00s)
767660
zhaohanwen楼主2023/1/11 16:37

记录

代码

#include <iostream>
#include <queue>
#include <functional>
using namespace std ;
priority_queue<int , vector<int> , greater<int> > fru ;
int main()
{
 int n , tot = 0 ;
 cin >> n ;
 for (int i = 1 ; i = n ; i ++)
 {
 int temp ;
 cin >> temp ;
 fru.push(temp) ;
 }
 for (int i = 1 ; i = n - 1 ; i ++)
 {
 int cnt = 0 ;
 cnt += fru.top() ;
 fru.pop() ; 
 cnt += fru.top() ;
 fru.pop() ;
 fru.push(cnt) ;
 tot += cnt ; 
 }
 cout << tot << endl;
 return 0 ;
}
2023/1/11 16:37
加载中...