CF1519B.The Cake Is a Lie

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

The Cake Is a Lie

There is a n×mn \times m grid. You are standing at cell (1,1)(1, 1) and your goal is to finish at cell (n,m)(n, m).

You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x,y)(x, y). You can:

  • move right to the cell (x,y+1)(x, y + 1) — it costs xx burles;
  • move down to the cell (x+1,y)(x + 1, y) — it costs yy burles.

Can you reach cell (n,m)(n, m) spending exactly kk burles?

Input

The first line contains the single integer tt (1t1001 \le t \le 100) — the number of test cases.

The first and only line of each test case contains three integers nn, mm, and kk (1n,m1001 \le n, m \le 100; 0k1040 \le k \le 10^4) — the sizes of grid and the exact amount of money you need to spend.

Output

For each test case, if you can reach cell (n,m)(n, m) spending exactly kk burles, print YES. Otherwise, print NO.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as positive answer).

Note

In the first test case, you are already in the final cell, so you spend 00 burles.

In the second, third and fourth test cases, there are two paths from (1,1)(1, 1) to (2,2)(2, 2): (1,1)(1, 1) \rightarrow (1,2)(1, 2) \rightarrow (2,2)(2, 2) or (1,1)(1, 1) \rightarrow (2,1)(2, 1) \rightarrow (2,2)(2, 2). Both costs 1+2=31 + 2 = 3 burles, so it's the only amount of money you can spend.

In the fifth test case, there is the only way from (1,1)(1, 1) to (1,4)(1, 4) and it costs 1+1+1=31 + 1 + 1 = 3 burles.

Samples

6
1 1 0
2 2 2
2 2 3
2 2 4
1 4 3
100 100 10000
YES
NO
YES
NO
YES
NO

在线编程 IDE

建议全屏模式获得最佳体验