codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

23B.md (913B)


      1 Source: https://codeforces.com/problemset/problem/23/B
      2 
      3 B. Party
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 *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.
     22 
     23 What is the maximum amount of people that could stay at the party in the end?
     24 
     25 Input
     26 
     27 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).
     28 
     29 Output
     30 
     31 For each test output in a separate line one number — the maximum amount of people that could stay in the end.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 1  
     39 3
     40 ```
     41 
     42 Output
     43 
     44 ```
     45 1
     46 ```