题解:P12418 【MX-X12-T1】「ALFR Round 5」地铁

· · 题解

我们可以简单讨论一下情况:

#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
signed main(){
    int t;
    cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        if(n==1||m==1) {
            cout<<1;
        }
        else{
            cout<<min(n,m)+1;
        }
        cout<<endl;
    }
    return 0;
}