题解:CF374A Inna and Pink Pony

· · 题解

特判在角上;特判不能动;特判无解。

一个角能到当且仅当存在 s,t 使得 (x+ta,y+sb) 是角且 ts 奇偶性一致。此时所需操作为 \max(s,t)

分四个角讨论取答案最小即可。