308435: CF1519B. The Cake Is a Lie

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

The Cake Is a Lie

题意翻译

## 题目描述 有一个 $n\times m$ 的矩阵,初始时你站在 $(1,1)$ ,终点在 $(n,m)$。 当你站在 $(x,y)$ 时,你可以: - 走向 $(x,y+1)$,获得 $x$ 点分数; - 走向 $(x+1,y)$,获得 $y$ 点分数。 请问你是否可以在走到终点时**恰好获得** $k$ 点分数。 ## 输入格式 第一行有一个正整数 $t$ ( $1\le t\le 100$ ),表示询问组数。 接下来 $t$ 行,每行三个正整数 $n,m,k$ ( $1\le n,m \le 100$,$0\le k\le 10^4$ ),意义与题目描述中相同。 ## 输出格式 对于每组询问,若满足要求则输出 `YES`,否则输出 `NO`。 Translated by Rosmarinus.

题目描述

There is a $ n \times m $ grid. You are standing at cell $ (1, 1) $ and your goal is to finish at cell $ (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) $ . You can: - move right to the cell $ (x, y + 1) $ — it costs $ x $ burles; - move down to the cell $ (x + 1, y) $ — it costs $ y $ burles. Can you reach cell $ (n, m) $ spending exactly $ k $ burles?

输入输出格式

输入格式


The first line contains the single integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The first and only line of each test case contains three integers $ n $ , $ m $ , and $ k $ ( $ 1 \le n, m \le 100 $ ; $ 0 \le k \le 10^4 $ ) — the sizes of grid and the exact amount of money you need to spend.

输出格式


For each test case, if you can reach cell $ (n, m) $ spending exactly $ k $ 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).

输入输出样例

输入样例 #1

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

输出样例 #1

YES
NO
YES
NO
YES
NO

说明

In the first test case, you are already in the final cell, so you spend $ 0 $ burles. In the second, third and fourth test cases, there are two paths from $ (1, 1) $ to $ (2, 2) $ : $ (1, 1) $ $ \rightarrow $ $ (1, 2) $ $ \rightarrow $ $ (2, 2) $ or $ (1, 1) $ $ \rightarrow $ $ (2, 1) $ $ \rightarrow $ $ (2, 2) $ . Both costs $ 1 + 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) $ to $ (1, 4) $ and it costs $ 1 + 1 + 1 = 3 $ burles.

Input

题意翻译

## 题目描述 有一个 $n\times m$ 的矩阵,初始时你站在 $(1,1)$ ,终点在 $(n,m)$。 当你站在 $(x,y)$ 时,你可以: - 走向 $(x,y+1)$,获得 $x$ 点分数; - 走向 $(x+1,y)$,获得 $y$ 点分数。 请问你是否可以在走到终点时**恰好获得** $k$ 点分数。 ## 输入格式 第一行有一个正整数 $t$ ( $1\le t\le 100$ ),表示询问组数。 接下来 $t$ 行,每行三个正整数 $n,m,k$ ( $1\le n,m \le 100$,$0\le k\le 10^4$ ),意义与题目描述中相同。 ## 输出格式 对于每组询问,若满足要求则输出 `YES`,否则输出 `NO`。 Translated by Rosmarinus.

加入题单

算法标签: