Message Spreading
Submissions: 2971   Accuracy:

59.49%

  Difficulty: Basic   Marks: 1

There are N students in a class, each in possession of a different funny story. As the students were getting bored in the class, they decided to come up with a game so that they can pass their time.

They want to share the funny stories with each other by sending electronic messages. Assume that a sender includes all the funny stories he or she knows at the time the message is sent and that a message may only have one addressee. What is the minimum number of messages they need to send to guarantee that everyone of them gets all the funny stories?

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each testcase contains an integer N denoting the number of students.

Output:
For each testcase, print the minimum number of messages they need to send to guarantee that everyone of them gets all the funny stories.

Constraints:
1<=T<=100
1<=N<=105

Example:
Input:

1
2
Output:
2

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ankit Sharma
Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.