Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
排号
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 91, Accepted users: 85
Problem 10074 : No special judgement
Problem description
  有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。

Input
  有多个测试数据,每个测试数据占一行,输入一个整数n(1≤n≤5000),表示围成一圈的人数。

Output
  输出一个整数,表示最后留下的人原来的位号。

Sample Input
10
100
200
3000
5000
Sample Output
4
91
128
910
2864
Problem Source
  Teacher yxl

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2081 today,16258808 total, since 2010-05-07