Chinaunix首页 | 论坛 | 博客
  • 博客访问: 750300
  • 博文数量: 217
  • 博客积分: 2401
  • 博客等级: 大尉
  • 技术积分: 2030
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-16 06:58
个人简介

怎么介绍?

文章分类

全部博文(217)

文章存档

2023年(2)

2022年(3)

2021年(29)

2020年(12)

2019年(5)

2018年(5)

2017年(5)

2016年(3)

2015年(6)

2014年(12)

2013年(16)

2012年(9)

2011年(6)

2010年(15)

2009年(30)

2008年(59)

我的朋友

分类:

2008-04-19 02:23:56


圆圈上顺时针排列着1,2,3,....2000 这
2000个数. 从1开始,顺时针隔一个拿走一个(1最先被拿走,下一个是3被拿走).
问最后剩下是哪一个数字.

For a general positive integer m, assume k s.t. 2^k < m <= 2^{k+1}
The answer is 2m-2^{k+1}
reason: in the first round, delete 1,3,...,2m-2^{k+1}-1,
now there are m-2^{k}+2^{k+1}-m=2^k left. Since it is a circle, rename
2m-2^{k+1}+1 to be 1, 2m-2^{k+1}+2 to be 2, and 2m-2^{k+1} to be 2^k,
now it's easy to see that the last number is 2m-2^{k+1}


the recursion formula is:
f(2n) = 2f(n); since if it is even then the odds are eliminated first and
start with the game starting with the first even number again.

f(2n+1) can be given in another way:

if n==2^k
f(2n+1)=2
else
f(2n+1)=f(2n)+2


Now the solution is:
f(2000)=16*f(125)

f(2000)=2^4(2+2^2(2+2(2+2(2+2(2)))))=1952, note f(1+2)=2
阅读(1644) | 评论(0) | 转发(0) |
0

上一篇:Rockets

下一篇:figure reference

给主人留下些什么吧!~~