Thursday, 13 August 2015

         MINIMUM DRAWS-HACKERRANK SOLUTION


Problem Statement
Jim is off to a party and is searching for a matching pair of socks. His drawer is filled with socks, each pair of a different color. In its worst case scenario, how many socks (x) should Jim remove from his drawer in the worst case scenario after which he finds a matching pair?
Input Format
The first line contains the number of test cases T.
Next T lines contains an integer N which indicates the total pairs of socks present in the drawer.
Output Format
Print the number of Draws (x) Jim makes in the worst case scenario.
Constraints
1T1000
0<N<106
Sample Input
2
1
2
Sample Output
2
3
 

SOLUTION : 

#include<iostream>
using namespace std;
int main()
{
int t,n,k;
cin>>t;
while(t--)
{
cin>>n;
k=n+1;
cout<<k<<endl;
}
return 0;
}