题解 | 纸牌游戏

纸牌游戏

https://www.nowcoder.com/practice/74f915e366094b19b94334de8b68e733

#include <iostream>
using namespace std;
 
int main() {
    int t;
    cin >> t;
    while (t--)
    {
        int a1,a2,b1,b2;
        cin >> a1>>a2>> b1>>b2;
        if(a1<a2)
        {
            int temp = a1;
            a1 = a2;
            a2 = temp;
        }
        if(b1<b2)
        {
            int temp = b1;
            b1 = b2;
            b2 = temp;
        }
 
        if (a1<b1||a2<b2||
        a1==b1&&a2==b2)
        {
            cout << 0 << endl;
            continue;
        }
 
        if (a2>b1||
        a2==b1&&(a1!=a2||b1!=b2))
        {
            cout << 4 << endl;
            continue;
        }
 
        cout << 2<<endl;
    }
}

全部评论

相关推荐

LuminousZJ:不行,最后还是要看学信网的,这点不能伪装,也骗不过人家,得不偿失
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务