3 条题解

  • 0
    @ 2024-7-18 21:23:28
    
    

    #include <bits/stdc++.h> using namespace std; struct node{ int x, y; }; bool cmp(node A, node B){ if(A.x != B.x) return A.x < B.x; else return A.y > B.y; } node T[1010]; int main(){ freopen("point.in","r",stdin); freopen("point.out","w",stdout); int n; cin>>n; for (int i = 1; i <= n; i ++){ int a, b; cin >> a >> b; T[i] = {a,b}; } sort(T+1,T+1+n,cmp); for (int i = 1; i <= n; i ++){ cout << T[i].x << " " << T[i].y << endl; } return 0; }

    
    
    • 0
      @ 2024-7-18 21:23:08
      
      

      #include <bits/stdc++.h> using namespace std; struct node{ int x, y; }; bool cmp(node A, node B){ if(A.x != B.x) return A.x < B.x; else return A.y > B.y; } node T[1010]; int main(){ freopen("point.in","r",stdin); freopen("point.out","w",stdout); int n; cin>>n; for (int i = 1; i <= n; i ++){ int a, b; cin >> a >> b; T[i] = {a,b}; } sort(T+1,T+1+n,cmp); for (int i = 1; i <= n; i ++){ cout << T[i].x << " " << T[i].y << endl; } return 0; }

      
      
      • 0
        @ 2024-7-18 21:22:57
        
        

        #include <bits/stdc++.h> using namespace std; struct node{ int x, y; }; bool cmp(node A, node B){ if(A.x != B.x) return A.x < B.x; else return A.y > B.y; } node T[1010]; int main(){ freopen("point.in","r",stdin); freopen("point.out","w",stdout); int n; cin>>n; for (int i = 1; i <= n; i ++){ int a, b; cin >> a >> b; T[i] = {a,b}; } sort(T+1,T+1+n,cmp); for (int i = 1; i <= n; i ++){ cout << T[i].x << " " << T[i].y << endl; } return 0; }

        
        
        • 1

        信息

        ID
        150
        时间
        1000ms
        内存
        256MiB
        难度
        5
        标签
        (无)
        递交数
        66
        已通过
        24
        上传者