CF53C.Little Frog
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once upon a time a little frog whose name was Vasya decided to travel around his home swamp. Overall there are n mounds on the swamp, located on one line. The distance between the neighboring mounds is one meter. Vasya wants to visit all the mounds in one day; besides, he wants to visit each one exactly once. For that he makes a route plan, to decide the order in which to jump on the mounds. Vasya can pick any mound as the first one. He thinks it boring to jump two times at the same distance. That's why he wants any two jumps on his route to have different lengths. Help Vasya the Frog and make the plan for him.
从前,一只名叫瓦夏的小青蛙决定在自家沼泽中旅行。沼泽中总共有 n 个土堆,它们位于同一条直线上,相邻土堆之间的距离为一米。瓦夏希望在一天之内访问所有土堆,且每个土堆恰好访问一次。为此,他需要制定一条路线计划,以确定跳跃访问各个土堆的顺序。瓦夏可以任选一个土堆作为起点。他觉得连续两次跳跃距离相同很无聊,因此他希望路线上任意两次跳跃的长度均不相同。请帮助青蛙瓦夏,为他制定这样一条路线计划。
输入格式
The single line contains a number n (1 ≤ n ≤ 104) which is the number of mounds.
单行包含一个数字 n(1 ≤ n ≤ 104),表示土堆的数量。
输出格式
Print n integers p__i (1 ≤ p__i ≤ n) which are the frog's route plan.
- All the p__i's should be mutually different.
- All the |p__i–p__i + 1|'s should be mutually different (1 ≤ i ≤ n - 1).
If there are several solutions, output any.
输出 $ n $ 个整数 $ p_i ( 1 \leq p_i \leq n $),表示青蛙的行进路线规划。
- 所有 $ p_i $ 必须互不相同。
- 所有 $ |p_i - p_{i+1}| ( 1 \leq i \leq n-1 $)必须互不相同。
若存在多个解,输出任意一个即可。
输入输出样例
输入#1
2
输出#1
1 2
输入#2
3
输出#2
1 3 2
输入解题思路,AI测评打分。不知道怎么写?