第二题链接 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

相关推荐

03-30 19:30
石家庄学院 Java
野蛮的柯基在游泳:都能入股了,还得是Java
点赞 评论 收藏
分享
牛客网
牛客企业服务