Consider the following program:
int t;
cin >> t;
for(int i = 0; i < t; i++){
int n;
cin >> n;
for(int i = 0; i < n; i++){
int temp;
cin >> temp;
}
}
cout << "END OF THE PROGRAM";
This program accepts the input as follows:
\(t\)
\(n\)
\(a_1a_2 a_3 ... a_n\)
\(n\)
\(a_1a_2 a_3 ... a_n\)
\(.\)
\(.\)
\(.\)
\(n\)
\(a_1a_2 a_3 ... a_n\)
And, then prints "END OF THE PROGRAM".
Suppose you provide following input to the program:
\(n\)
\(a_1a_2 a_3 ... a_n\)
The program might expect more numbers.
How many more numbers does the program must be given to get the "END OF THE PROGRAM" output. If there are multiple answers, then print the minimum answer.
Input format
- The first line will contain an integer \(n\). (\(1 \le n \le 1000000\))
- The second line contains \(n\) space-separated integers (\(1 \le a_i \le 1000000\)):
- \(n\)
- \(a_1a_2 a_3 ... a_n\)
Output format
Print a single integer denoting the answer to the problem.
5
1 2 3 1 2
The program will interpret the above input as follows:
5
1
2
3
1 2 x (The program expects some number here)
y (=0 for the minimum answer. Here the inner loop won't execute)
z (=0 for the minimum answer. Here the inner loop won't execute)
Now the program outputs "END OF THE PROGRAM"
So, the minimum number of numbers that the program expects is 3.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor