Welcome to Yumao′s Blog.
ZOJ Problem Set – 1350 The Drunk Jailer
, 2011年03月21日 , C Language , 评论 在〈ZOJ Problem Set – 1350 The Drunk Jailer〉中留言功能已關閉 ,

其實算是簡單題吧
用組數模擬下就出來了- –
哈。

The Drunk Jailer
Time Limit: 1 Second Memory Limit: 32768 KB
A certain prison contains a long hall of n cells, each right next to each other. Each cell has a prisoner in it, and each cell is locked.

One night, the jailer gets bored and decides to play a game. For round 1 of the game, he takes a drink of whiskey, and then runs down the hall unlocking each cell. For round 2, he takes a drink of whiskey, and then runs down the hall locking every other cell (cells 2, 4, 6, …). For round 3, he takes a drink of whiskey, and then runs down the hall. He visits every third cell (cells 3, 6, 9, …). If the cell is locked, he unlocks it; if it is unlocked, he locks it. He repeats this for n rounds, takes a final drink, and passes out.
(閱讀全文…)

关键字:, , , ,
分页 (1): 1