CFPARTY - Party
n people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2, 3, ..., n - 1 friends among those who stayed by the moment of their leaving, did the same.
What is the maximum amount of people that could stay at the party in the end?
Input
The first input line contains one number t — amount of tests (1 ≤ t ≤ 105). Each of the following t lines contains one integer number n (1 ≤ n ≤ 105).
Output
For each test output in a separate line one number — the maximum amount of people that could stay in the end.
Example
Input: 1 3 Output: 1
hide comments
free mind ;):
2014-02-23 09:42:19
just do it :) |
|
Bhavik:
2014-02-16 13:35:12
hit and trial.. |
|
rajat jain:
2013-12-06 17:13:00
don't know why my O(1) solution is giving me TLE... |
|
Ankit Jain:
2013-12-01 20:04:32
short code but the problem is baeutiful..:) |
|
Martijn Muijsers:
2013-10-18 13:27:40
Could you possibly give us a clear example? Your examples are unclear, I have no idea what you mean still sorry... |
|
Aman Kumar Sinha:
2013-05-31 11:04:45
when will people stop going.. is it when all the people presen have equal no of frnds |
|
conioh:
2013-01-18 12:05:37
Nice question.. |
|
Aman Gupta:
2012-08-22 20:37:27
@Mitch Schwartz- thanks for the explanation |
|
selfcompiler:
2011-12-21 06:37:29
hey buddy there is required of max.. output |
|
selfcompiler:
2011-12-21 06:36:35
HEY there is reqiurement of maximum output..........so there is answer is 1 |
Added by: | Efim |
Date: | 2010-08-02 |
Time limit: | 0.506s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 VB.NET |
Resource: | Codeforces |