2 条题解

  • 0
    @ 2025-12-1 11:15:55

    按题意直接模拟即可。

    AC code:

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    	long long x1, x2, y1, y2;//不开long long见祖宗
    	cin >> x1 >> y1 >> x2 >> y2;
    	if (x1 != x2 && y1 != y2) {
            cout << x1 << " " << y2 << endl;
        } else if (x1 == x2 && y1 != y2) {
            cout << "0" << " " << y2 << endl;
        } else {
            cout << x1 << " " << "0" << endl;
        }
    	return 0;
    }
    
    • 0
      @ 2025-9-4 21:59:40

      构造一条边平行于 xx 轴,一条边平行于 yy 轴的三角形即可。

      #include <bits/stdc++.h>
      #define y1 Y1
      using namespace std;
      int main()
      {
      	long long x1, x2, y1, y2;
      	cin >> x1 >> y1 >> x2 >> y2;
      	if (y1 != y2 && x1 != x2) cout << x1 << ' ' << y2 << endl;
      	if (y1 == y2 && x1 != x2) cout << x1 << ' ' << labs(y2) - 1 << endl;
      	if (y1 != y2 && x1 == x2) cout << labs(x1) - 1 << ' ' << y2 << endl;
      	return 0;
      }
      
      • 1

      信息

      ID
      42
      时间
      1000ms
      内存
      256MiB
      难度
      1
      标签
      递交数
      17
      已通过
      3
      上传者