Advertisement

华为OD机试 C++整数对最小值问题 2/满

阅读量:

**■**题目描述

复制代码
 #include <bits/stdc++.h>

    
  
    
 using namespace std;
    
  
    
 typedef long long ll;
    
  
    
 struct node {
    
     int to, cost;
    
  
    
     node(int x1, int x2) {
    
     to = x1;
    
     cost = x2;
    
     }
    
 };
    
  
    
 struct cmp {
    
     bool operator()(const node &a, const node &b) {
    
     return a.to + b.cost < a.cost + b.to;
    
     }
    
 };
    
  
    
 priority_queue<node, vector<node>, cmp> PriorityQueue;
    
  
    
 int main()
    
 {
    
     int n1, n2;
    
     cin >> n1;
    
  
    
     vector<int> 

全部评论 (0)

还没有任何评论哟~