include <bits/stdc++.h>
using namespace std;
int number; int l1,r1,l2,r2;
int main(){ cin >> number; for(int i = 0; i < number; i++){ cin >> l1 >> r1 >> l2 >> r2; //basically, check if the minimum number of min. or max. required //falls in range of minimums and maxiums that must appear for //valid beautiful array! if(l2<=l1<=r2 or l1<=l2<=r1){ cout << max(l1, l2) << endl; continue; } else{ cout << l1 + l2 << endl; } } }
Basically, the input first line contains number of test cases. And for the following lines, each line is a test case containing each 4 integers, each separated by white space character. I was wondering what would be a good way to read from this for each test case. Thanks!
I create another function solve and then write a cycle.