作者Byzantin (拜占庭)
看板Grad-ProbAsk
標題Re: [理工] [離散] 98台大電機
時間Mon Aug 1 15:08:18 2011
假設1為改變status,0為不改變
locker 1 2 3 4 5 6 7 ‧‧‧
student1 1 1 1 1 1 1 1 ‧‧‧
student2 0 1 0 1 0 1 0 ‧‧‧
student3 0 0 1 0 0 1 0 ‧‧‧
student4 0 0 0 1 0 0 0 ‧‧‧
‧
‧
‧
locker還是open的條件是該行為1的bit數有奇數個,
每個locker在遇到編號的因數時該列bit會是1
所以最後是open的locker它的編號的因數為奇數個
即完全平方數,所以是1,4,9,16,25,36,49,64,81,100
※ 引述《ceo890710 (Drinking)》之銘言:
: ---------------------------------------------------------------------
: One hundred students enter a locker room that contains 100 lockers.
: The first student open all the lockers.The second student changes the
: status(from open to closed, and vice versa) of every other locker,
: starting with the second locker.The third student then changes the
: status of every third locker,starting with the third locker.In general,
: for 1<=K<=100,the kth student changes the status of every kth locker,
: starting with the kth locker.After the 100th student has gone through
: the lockers,which lockers are left open?
: 想問一下這題大家會怎麼解?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.174.0.123
推 mqazz1:推 08/01 18:36
推 wheels:推!只有在完全平方時,自己沒辦法乘自己,其它都可成pair 08/02 00:06
推 da0910cc: 08/02 08:16
推 ceo890710:我懂了~!!謝謝!! 08/03 20:27