979A.md (1789B)
1 Source: https://codeforces.com/problemset/problem/979/A 2 3 A. Pizza, Pizza, Pizza!!! 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 128 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Katie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems. 22 23 Today is Shiro's birthday. She really loves pizza so she wants to invite her friends to the pizza restaurant near her house to celebrate her birthday, including her best friends Katie and Kuro. 24 25 She has ordered a very big round pizza, in order to serve her many friends. Exactly $n$ of Shiro's friends are here. That's why she has to divide the pizza into $n + 1$ slices (Shiro also needs to eat). She wants the slices to be exactly the same size and shape. If not, some of her friends will get mad and go home early, and the party will be over. 26 27 Shiro is now hungry. She wants to cut the pizza with minimum of straight cuts. A cut is a straight segment, it might have ends inside or outside the pizza. But she is too lazy to pick up the calculator. 28 29 As usual, she will ask Katie and Kuro for help. But they haven't come yet. Could you help Shiro with this problem? 30 31 Input 32 33 A single line contains one non-negative integer $n$ ($0 \le n \leq 10^{18}$) — the number of Shiro's friends. The circular pizza has to be sliced into $n + 1$ pieces. 34 35 Output 36 37 A single integer — the number of straight cuts Shiro needs. 38 39 Examples 40 41 Input 42 43 ``` 44 3 45 ``` 46 47 Output 48 49 ``` 50 2 51 ``` 52 53 Input 54 55 ``` 56 4 57 ``` 58 59 Output 60 61 ``` 62 5 63 ``` 64 65 Note 66 67 To cut the round pizza into quarters one has to make two cuts through the center with angle $90^{\circ}$ between them. 68 69 To cut the round pizza into five equal parts one has to make five cuts.