CF46A.Ball Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count.

The game goes as follows. Kids stand in circle. Let's agree to think of the children as numbered with numbers from 1 to n clockwise and the child number 1 is holding the ball. First the first child throws the ball to the next one clockwise, i.e. to the child number 2. Then the child number 2 throws the ball to the next but one child, i.e. to the child number 4, then the fourth child throws the ball to the child that stands two children away from him, i.e. to the child number 7, then the ball is thrown to the child who stands 3 children away from the child number 7, then the ball is thrown to the child who stands 4 children away from the last one, and so on. It should be mentioned that when a ball is thrown it may pass the beginning of the circle. For example, if n = 5, then after the third throw the child number 2 has the ball again. Overall, n - 1 throws are made, and the game ends.

The problem is that not all the children get the ball during the game. If a child doesn't get the ball, he gets very upset and cries until Natalia Pavlovna gives him a candy. That's why Natalia Pavlovna asks you to help her to identify the numbers of the children who will get the ball after each throw.

一位幼儿园老师娜塔莉亚·帕夫洛夫娜发明了一种新的球类游戏。这个游戏不仅能锻炼孩子们的身体素质,还能教他们数数。

游戏规则如下:孩子们围成一个圆圈站立。我们约定:顺时针方向将孩子们编号为 11nn,且编号为 11 的孩子手持球。首先,第 11 个孩子将球顺时针传给下一个孩子,即传给编号为 22 的孩子;接着,编号为 22 的孩子将球顺时针传给隔一个孩子的孩子,即传给编号为 44 的孩子;然后,编号为 44 的孩子将球顺时针传给与自己相隔两个孩子的孩子,即传给编号为 77 的孩子;再之后,球被传给与编号为 77 的孩子相隔三个孩子的孩子;接着,球被传给与上一个接球者相隔四个孩子的孩子;依此类推。需要特别说明的是:传球过程中球可能绕过圆圈起点(即发生“循环”)。例如,若 n=5n = 5,则第三次传球后,球会再次回到编号为 22 的孩子手中。整个游戏共进行 n1n - 1 次传球,随后结束。

问题在于,并非所有孩子都会在游戏过程中接到球。如果某个孩子没有接到球,他就会非常伤心并哭泣,直到娜塔莉亚·帕夫洛夫娜给他一颗糖果为止。因此,娜塔莉亚·帕夫洛夫娜请你帮她找出每次传球后接到球的孩子的编号。

输入格式

The first line contains integer n (2 ≤ n ≤ 100) which indicates the number of kids in the circle.

第一行包含一个整数 nn2n1002 \leq n \leq 100),表示圆圈中孩子的数量。

输出格式

In the single line print n - 1 numbers which are the numbers of children who will get the ball after each throw. Separate the numbers by spaces.

在单行中输出 n1n-1 个数字,表示每次传球后得到球的孩子的编号。数字之间用空格分隔。

输入输出样例

  • 输入#1

    10

    输出#1

    2 4 7 1 6 2 9 7 6
  • 输入#2

    3

    输出#2

    2 1

输入解题思路,AI测评打分。不知道怎么写?

首页