A — Two distinct points
原题链接:https://codeforces.com/group/5yyKg9gx7m/contest/265863/problem/A
题目大意:
给出2个区间,分别输出一个在区间内的整数,这2个数不能相等。
题目分析:
要选的整数分别从2个区间的左边开始,两数相同则其中一个整数取对应区间的下一个整数。(水题)
代码实现:
#include <iostream>
using namespace std;
int main()
{
int t;
int a, b, c, d; //两个区间[a,b],[c,d]
int n1, n2; //要选的数
cin >> t;
while(t--)
{
cin >> a >> b >> c >> d;
for(n1=a; n1<=b; n1++){
for(n2=c; n2<=d; n2++){
if(n1 != n2){
cout << n1 << ' ' << n2 << endl;
goto END; //满足则直接跳出循环
}
}
}
END:
;
}
return 0;
}
最后希望路过的dl能给予改进的建议!