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
|
||||||
2020-09-17 18:06:45
Awesome problem. |
||||||
2019-01-09 12:06:42
AC in go....easy one :) |
||||||
2018-03-28 21:09:59
easy problem..............just think of people as node of graph!!!! but there is no fancy graph algorithm involved.........just thinking in terms of graph make it easier to crack!!! |
||||||
2015-09-03 00:31:42
Finally AC after wasting 10 minutes. Worst problem ever! Got 2 WA in CPP/C because I think that if n = 1, answer should be 1 but answer is 0. :/ And Yes ofcourse, using input() function in python awards you with a TLE. -_- |
||||||
2015-08-12 02:55:18 Rahul yadav
easy but not much logical problem |
||||||
2015-01-12 18:12:21 Sayak Haldar
Finally got the idea...:/ after a long thinking procees Last edit: 2015-01-12 18:14:13 |
||||||
2015-01-11 22:01:06 Abhinandan Agarwal
Awesome problem .. Thumbs up setter (y) |
||||||
2014-10-20 13:28:51 jinkies
trial and error probem.. just use fast i/o |
||||||
2014-08-31 19:26:47 Vijendra parmar
just go with scanf/printf |
||||||
2014-06-05 23:43:49 pvkcse
AC at first go...easy one...!!! |