407795: GYM102894 C Special Christmas Cake
Description
The family of Diana, a nanotechnologist, is getting ready for Christmas. In order to surprise both of her best friends — Vova and Grisha — she decided to bake a pie, shaped like a $$$n$$$-sided regular polygon.
Suddenly, Diana recalled that Vova enjoys $$$a$$$-sided pies (not necessarily regular), and Grisha enjoys $$$b$$$-sided pies. Is it possible for her to split the pie with a single knife cut into two non-empty parts so that one has exactly $$$a$$$ sides, and the other has exactly $$$b$$$ sides?
InputThe first line contains a single positive integer $$$n$$$ $$$(3 \le n \le 10^9)$$$ — the number of sides in the pie.
The second line contains a single positive integer $$$a$$$ $$$(3 \le a \le 10^9)$$$ — the number of sides that appeals to Vova.
The third line contains a single positive integer $$$b$$$ $$$(3 \le b \le 10^9)$$$ — the number of sides that appeals to Grisha.
OutputOutput YES if Diana can split the pie so that both guests will enjoy it, and NO otherwise.
Scoring№ | Points | Limits | Dependencies | Grading policy |
1 | 18 | $$$n = 3$$$ | - | complete |
2 | 22 | $$$n \le 5$$$ | 1 | complete |
3 | 45 | $$$n \le 100$$$ | 1, 2 | complete |
4 | 15 | $$$n \le 10^9$$$ | 1, 2, 3 | complete |
4 3 3Output
YESInput
4 4 4Output
YESNote
Diana can cut a square pie into two triangular parts by splitting it along the diagonal. The resulting parts won't be regular polygons — in fact, they will be right triangles — but this is not important, according to the statement.
Also, she can cut a square pie into two rectangular ones, splitting it parallel to two of its sides.