while (Q.size() > 1) { int x = Q.top(); Q.pop(); int y = Q.top(); Q.pop(); ans += x + y; Q.push(x + y); } 这是板子吗?还是现推呀
点赞
牛客网
牛客企业服务