#郑秀妍[超话]##郑秀妍[超话]##郑秀妍0418生日快乐# Happy birthday JessI'm thrilled that you're gonna back on the stage and perform again!!!! It is definitely the best news that I have ever heard this year!!@Sy__Jessica 真的太激动了看到西卡参加浪姐,终于能有舞台啦!!她是我的整个青春!
780. Reaching Points
Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise.
The allowed operation on some point (x, y) is to convert it to either (x, x + y) or (x + y, y).
解题重点:
1. 可以正向递归,但是递归深度太大,时间复杂度太高。
2. 可以反向计算,对于tx,ty,只有tx != ty时才存在上衣状态,且上一状态唯一。
3. 如果tx>ty,则上一状态是(tx-ty, ty);如果tx4. 由于反向操作一定是将tx,ty中较大的值减小,因此当tx>ty时可以直接将tx的值更新为tx mod ty, 当tx5. 最后,如果tx=sx且ty=sy,结果为true。tx=sx且ty !=sy,只有当ty>sy且(ty-sy)mod sx = 0时,结果为true。ty=sy且tx != sx,只有当tx>sx且(tx-sx)mod sy = 0时为true。否则为false。
Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise.
The allowed operation on some point (x, y) is to convert it to either (x, x + y) or (x + y, y).
解题重点:
1. 可以正向递归,但是递归深度太大,时间复杂度太高。
2. 可以反向计算,对于tx,ty,只有tx != ty时才存在上衣状态,且上一状态唯一。
3. 如果tx>ty,则上一状态是(tx-ty, ty);如果tx
geluk is aan jou sy; Die son skyn helder teen die middag, en die glimlag is in jou hart; Aand sonsondergang op die westelike berg, vreugde met jou dag. Gelukkige nuwe jaar! Gelukkige nuwe jaar! Beste wense! Die eerste sonstrale is my diep seëninge vir jou, die laaste tikkie rooi teen sononder is my opregte groet aan jou, by geleentheid van Nuwejaarsdag, stuur opregte wense: Gelukkige Nuwejaarvfh
✋热门推荐