关键在于模拟游戏中比较的过程,理清获胜的条件是胜场大于负场,再从第一场和第二场的情况来判断是否获胜即可.

#include <iostream>
using namespace std;
bool judge(int a1,int a2,int b1,int b2){//将a1和b1比较,a2和b2比较
    if(a1>b1 && a2>=b2) return true; 
    if(a1==b1 && a2>b2) return true;   //胜场大于负场
    return false;//负场大于胜场
}
void solve(){
    int a1,a2,b1,b2;
    cin>>a1>>a2>>b1>>b2;
    int ans=0;
    if(judge(a1,a2,b1,b2)) ans++;
    if(judge(a1,a2,b2,b1)) ans++;
    if(judge(a2,a1,b1,b2)) ans++;
    if(judge(a2,a1,b2,b1)) ans++;
    cout<<ans<<endl;
}
int main() {
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}