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 A_i dollars per piece of tuna sashimi and B_i dollars per piece of tuna nigiri. Pusheen has decided that before tax and tip, the amount of money she spends should be exactly N_i dollars for restaurant i. Is it possible for Pusheen to spend exactly N_i dollars on sashimi and nigiri? (Don't worry, she's budgeted money for the tip!)

Constraints

1 \le T \le 2500

1 \le A_i \le B_i \le 50

1 \le N_i \le 50

In tests worth 3 marks, A_i = 1.

In tests worth an additional 3 marks, B_i will be divisible by A_i.

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, A_i, B_i, and N_i, indicating that her favourite sushi restaurant is charging A_i dollars per piece for sashimi and B_i dollars per piece for nigiri, and Pusheen's budget purely for the sashimi and nigiri is N_i 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

2
2 2 2
3 4 5

Sample Output

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.