Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
所有线路的bus两两匹配,如果可以碰到加入同一集合,最后看是否只有1个集合设i线路周期为ti,j线路周期为tj,ij某个公共站k i线某bus到k要走a个站 j线某bus到k要走b个站 ti * x + a = tj * y + b 只要有xy非负整数解,则这2个bus肯定可以在k站碰面 有解条件为 abs(a-b) % gcd(x,y) == 0 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator