C语言10.18

Time Limit: 1000ms
Memory Limit: 32768KB
64-bit integer IO format: %lld      Java class name: Main

Description

有n个人围成一圈,顺序从1开始排号。从第1个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。

Input

只有一个正整数n,保证n不超过1000。

Output

输出最后留下的人的原始编号。
请注意行尾输出换行。

Sample Input

10

Sample Output

4

Author

Admin
Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .