CF979A.Pizza, Pizza, Pizza!!!
入门
通过率:0%
时间限制:1.00s
内存限制:128MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
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.
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.
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.
As usual, she will ask Katie and Kuro for help. But they haven't come yet. Could you help Shiro with this problem?
凯蒂、库洛和白露是最好的朋友。她们从幼儿园起就相识了,因此经常彼此分享一切,并一起解决一些非常困难的问题。
今天是白露的生日。她非常喜欢披萨,因此想邀请她的朋友们(包括她最好的朋友凯蒂和库洛)到她家附近的披萨店庆祝生日。
她点了一个非常大的圆形披萨,以便招待众多朋友。恰好有 n 位白露的朋友到场,因此她需要将披萨切成 n+1 块(白露自己也要吃)。她希望每一块的大小和形状都完全相同;否则,有些朋友会生气并提前离场,聚会也就结束了。
白露现在饿了,她希望用最少的直线切割次数完成分披萨。每次切割是一条直线段,其端点可以在披萨内部或外部。但她太懒了,不想拿起计算器计算。
照例,她会向凯蒂和库洛求助。但她们还没到。你能帮白露解决这个问题吗?
输入格式
A single line contains one non-negative integer n (0≤n≤1018) — the number of Shiro's friends. The circular pizza has to be sliced into n+1 pieces.
一行包含一个非负整数 n(0≤n≤1018)——即 Shirō 的朋友人数。这个圆形披萨需要被切成 n+1 块。
输出格式
A single integer — the number of straight cuts Shiro needs.
一个整数——Shiro 所需的直线切割次数。
输入输出样例
输入#1
3
输出#1
2
输入#2
4
输出#2
5
说明/提示
To cut the round pizza into quarters one has to make two cuts through the center with angle 90∘ between them.
To cut the round pizza into five equal parts one has to make five cuts.
要将圆形披萨切成四等份,需要通过圆心做两条夹角为 90∘ 的切线。
要将圆形披萨切成五等份,需要做五次切割。
输入解题思路,AI测评打分。不知道怎么写?