[CF1313B] Different Rules

给定一个人两场比赛的排名和比赛人数,总排名按照两场比赛的排名和进行,问这个人的排名(即小于等于它的包括他自己的人数)

Solution

大力猜结论(见代码)

#include <bits/stdc++.h>
using namespace std;

int t,n,x,y;

signed main() {
    ios::sync_with_stdio(false);
    cin>>t;
    while(t--) {
        cin>>n>>x>>y;
        cout<<max(1,min(n,n-(n-x)-(n-y)+1))<<" "<<min(n,x+y-1)<<endl;
    }
}
原文地址:https://www.cnblogs.com/mollnn/p/12468229.html