sjp1114's blog

By sjp1114, history, 6 weeks ago, In English

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!

  • Vote: I like it
  • +1
  • Vote: I do not like it

6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I create another function solve and then write a cycle.

void solve() {

int32_t main() {
    cin.tie(0); cout.tie(0);
    int st = 1;
    cin >> st;
    while(st--) {
    return 0;