G.智乃的比较函数(easy version)(2024牛客寒假训练营3)

题目大意:是否有逻辑问题。

方法:无脑枚举

代码如下:

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using T = pair<int, int>;
//set<int>S;
//unordered_map<int, int>mp;
const int N = 2e5 + 10;
int a[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while (t--) {
        int n; cin >> n;
        int i;
        if (n == 1) {
            int x, y, z; cin >> x >> y >> z;
            if (x == y && z == 1) {
                cout << "No" << endl;
            }
            else cout << "Yes" << endl;
            continue;
        }
        int flag = 1;
        int x1, y1, z1; cin >> x1 >> y1 >> z1;
        if (x1 == y1 && z1 == 1) {
            flag=0;
        }
        int x2, y2, z2; cin >> x2 >> y2 >> z2;
        if (x2 == y2 && z2 == 1) {
            flag=0;
        }

        if (z1 == 0) {
            if (x2 == x1 && y2 == y1 && z2 == 1)flag = 0;
        }
        else {
            if (z2 == 0&&x2==x1&&y2==y1) {
                flag = 0;
            }
            if (z2 == 1 && x2 == y1 && y2 == x1)flag = 0;
        }
        if (flag)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值