1. 程式人生 > >hdu5512 Pagodas(2015ACM/ICPC亞洲區瀋陽站-重現賽(感謝東北大學) )

hdu5512 Pagodas(2015ACM/ICPC亞洲區瀋陽站-重現賽(感謝東北大學) )

n pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1abn) withstood the test of time.

Two monks, Yuwgna and Iaka, decide to make glories great again. They take turns to build pagodas and Yuwgna takes first. For each turn, one can rebuild a new pagodas labelled i
(i{a,b}and1in)
if there exist two pagodas standing erect, labelled j and k respectively, such that i=j+k or i=jk. Each pagoda can not be rebuilt twice.

This is a game for them. The monk who can not rebuild a new pagoda will lose the game.