ssavi's blog

By ssavi, history, 8 years ago, In English

Hi Experts of CF .

I am in a Fix. Hope someone of You can help me out . Here is my Problem :

Sometimes we can see there are several Problems whose Input Data co-ordinated with a Test Case & Several Tests under it. But It does not mention How many Data we have to take as input for a several Test Case . It just mentioned there that There would be a Blank line between Two Consecutive Test Cases . Even if There will be a Blank line between The input Number of Test Case & the First Test Case .As well as there will be a Blank Line between the Last & Second Last Case .But there is No Terminating Empty line after the Last test Case . For Example

3

1
2
3

1
2
3

1
2
3

Now My Question How Can I take this Type of Inputs maintaining The Case Blocks .

Related Problem : https://uva.onlinejudge.org/external/4/497.pdf

Thanks in Advance . Sorry For My Bad English .

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
11 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I see you have posted this query long ago, and you probably would have found out the solution for that, but in case you haven't and for those who also have same issues, can check this below.

int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector v(n); for (int i = 0; i < n; i++) { cin >> v[i]; }

// quick check if you have taken the input correctly
    for (auto &x: v) {
        cout << x << " ";

} cout << '\n'; // hope this helps :) best of luck with solving the rest of problem :p } }