683D.md (1322B)
1 Source: https://codeforces.com/problemset/problem/683/D 2 3 D. Chocolate Bar 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 A chocolate bar has a rectangular shape and consists of *n* × *m* slices. In other words, a bar consists of *n* rows with *m* slices of chocolate in each row. 22 23 Each slice of chocolate is known to weigh 1 gram. Your task is to determine for each of the *q* chocolate bars whether it is possible to obtain a piece weighing *p* grams by breaking the bar several (possibly zero) times. The final piece of the chocolate bar should be whole, and breaks are made along the line of slices' section for the whole length of the current piece. 24 25 Input 26 27 The first line contains the positive integer *q* (1 ≤ *q* ≤ 100) — the number of chocolate bars. 28 29 Each of the following *q* lines contains three positive integers *n*, *m* and *p* (1 ≤ *n*, *m*, *p* ≤ 1000) — the size of the chocolate bar, and the weight of the piece which should be obtained. 30 31 Output 32 33 The output should contain *q* lines and the *i*-th line must contain "Yes" (without the quotes), if it is possible to perform the task for *i*-th chocolate bar, or "No" otherwise. 34 35 Example 36 37 Input 38 39 ``` 40 2 41 3 3 4 42 4 4 7 43 ``` 44 45 Output 46 47 ``` 48 Yes 49 No 50 ```