Mock CCC '19 Contest 1 J3 - Pusheen Eats Tuna Sashimi and Tuna Nigiri

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

Pusheen has been dreaming about tuna sashimi! She has decided that she needs to eat more tuna in her life, so she decides to visit T restaurants to eat tuna sashimi and tuna nigiri.

Each restaurant that Pusheen wishes to visit sells sashimi and nigiri at their own prices - restaurant i sets their prices at Ai dollars per piece of tuna sashimi and Bi dollars per piece of tuna nigiri. Pusheen has decided that before tax and tip, the amount of money she spends should be exactly Ni dollars for restaurant i. Is it possible for Pusheen to spend exactly Ni dollars on sashimi and nigiri? (Don't worry, she's budgeted money for the tip!)

Constraints

1T2500

1AiBi50

1Ni50

In tests worth 3 marks, Ai=1.

In tests worth an additional 3 marks, Bi will be divisible by Ai.

Input Specification

The first line contains a single positive integer T, the number of times Pusheen repeats this exercise.

Each of the next T lines contains three positive space-separated integers, Ai, Bi, and Ni, indicating that her favourite sushi restaurant is charging Ai dollars per piece for sashimi and Bi dollars per piece for nigiri, and Pusheen's budget purely for the sashimi and nigiri is Ni dollars.

Output Specification

Output T lines. If Pusheen can order items accordingly from the ith restaurant, output YES on the ith line. Otherwise, output NO.

Sample Input

Copy
2
2 2 2
3 4 5

Sample Output

Copy
YES
NO

Sample Explanation

In the first example, Pusheen can order either one piece of sashimi or one piece of nigiri.

In the second example, Pusheen is unable to order exactly 5 dollars of items from sashimi or nigiri. One piece of nigiri costs four dollars, but two pieces of sashimi cost six dollars.


Comments

There are no comments at the moment.