A7870 | Ball Game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The first line contains integer $n$ ( $2<=n<=100$ ) which indicates the number of kids in the circle.
输出格式
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.
输入输出样例
输入 #1
10
输出 #1
2 4 7 1 6 2 9 7 6
输入 #2
3
输出 #2
2 1
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted