5

Question On How to Read Multiple Values For Each Single Line Test Case From Inpu...

 2 years ago
source link: http://codeforces.com/blog/entry/105915
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK