第二题链接 https://ac.nowcoder.com/acm/contest/17797/A 求问: 1. 我这个第二题的代码为啥不对 ``` #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL, pair<LL, LL>> PIII; LL n, m, k; int main(){ cin >> n >> m >> k; priority_queue<PIII> q; set<pair<LL, LL>> s; q.push({n*m, {n, m}}); s.insert({n, m}); while(--k &;&; !q.empty()){ PIII t = q.top(); LL tx = t.second.first, ty = t.second.second; q.pop(); if(s.count({tx - 1, ty}) == 0){ s.insert({tx - 1, ty}); q.push({(tx - 1) * ty, {tx - 1, ty}}); } if(s.count({tx, ty - 1}) == 0){ s.insert({tx, ty - 1}); q.push({(ty - 1) * tx, {tx, ty - 1}}); } } cout << q.top().first << endl; return 0; } ``` 2. 第三题怎么剪枝?
点赞 1

相关推荐

认真搞学习:28小登的建议,投算法岗不要写什么物理竞赛,互联网+,多写点项目,用什么算法做了什么。还有本科算法是不可能的开发你这个也没有项目啊
点赞 评论 收藏
分享
07-07 12:47
门头沟学院 Java
码农索隆:竟然还真有卡体检报告的
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务