Codeforces Round #622 (Div. 2) 比赛人数5752
总目录详见https://blog.csdn.net/mrcrack/article/details/103564004
在线测评地址https://codeforces.ml/contest/1313/problem/B
Problem | Lang | Verdict | Time | Memory |
---|---|---|---|---|
B - Different Rules | GNU C++11 | Accepted | 15 ms | 0 KB |
比赛时,没做出,赛后,也没做出,确实做不出。
看了数据范围,基本确定要么二分,要么有具体的公式、规律。手工打表找规律,工作量巨大,也就没有实施了。
参考视频:https://www.bilibili.com/video/av91242850?p=2
思路同https://blog.csdn.net/Doneoll/article/details/104481023
AC代码如下
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int t,n,x,y,good,bad;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&x,&y);
bad=min(n,x+y-1);
if(x+y<=n)good=1;
else good=min(n,x+y-n+1);//x+y>=n+1
printf("%d %d\n",good,bad);
}
return 0;
}