Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||
2014-02-23 09:42:19 free mind ;)
just do it :) |
||||||
2014-02-16 13:35:12 Bhavik
hit and trial.. |
||||||
2013-12-06 17:13:00 rajat jain
don't know why my O(1) solution is giving me TLE... |
||||||
2013-12-01 20:04:32 Ankit Jain
short code but the problem is baeutiful..:) |
||||||
2013-10-18 13:27:40 Martijn Muijsers
Could you possibly give us a clear example? Your examples are unclear, I have no idea what you mean still sorry... |
||||||
2013-05-31 11:04:45 Aman Kumar Sinha
when will people stop going.. is it when all the people presen have equal no of frnds |
||||||
2013-01-18 12:05:37 conioh
Nice question.. |
||||||
2012-08-22 20:37:27 Aman Gupta
@Mitch Schwartz- thanks for the explanation |
||||||
2011-12-21 06:37:29 selfcompiler
hey buddy there is required of max.. output |
||||||
2011-12-21 06:36:35 selfcompiler
HEY there is reqiurement of maximum output..........so there is answer is 1 |