909B.md (1257B)
1 Source: https://codeforces.com/problemset/problem/909/B 2 3 B. Segments 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 standard input 16 17 output 18 19 standard output 20 21 You are given an integer *N*. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and *N*, inclusive; there will be  of them. 22 23 You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis. 24 25 Find the minimal number of layers you have to use for the given *N*. 26 27 Input 28 29 The only input line contains a single integer *N* (1 ≤ *N* ≤ 100). 30 31 Output 32 33 Output a single integer - the minimal number of layers required to draw the segments for the given *N*. 34 35 Examples 36 37 Input 38 39 ``` 40 2 41 ``` 42 43 Output 44 45 ``` 46 2 47 ``` 48 49 Input 50 51 ``` 52 3 53 ``` 54 55 Output 56 57 ``` 58 4 59 ``` 60 61 Input 62 63 ``` 64 4 65 ``` 66 67 Output 68 69 ``` 70 6 71 ``` 72 73 Note 74 75 As an example, here are the segments and their optimal arrangement into layers for *N* = 4. 76 77 