Universal Cup Judging System

Universal Cup

Time Limit: 3.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓
Statistics

Hitagi Senjougahara は高さ $h$、幅 $w$ の 1 枚の紙を持っています。この紙は $1 \times 1$ のマス目に分けられています。紙の左下の角の座標を $(0, 0)$、右上の角の座標を $(h, w)$ とします。

Hitagi は垂直または水平の切断を何回か行うことができます。水平の切断では、Hitagi は整数の高さ $h' \in [1, h - 1]$ を選び、その直線を横切るすべての紙片を切断します。垂直の切断では、Hitagi は整数の幅 $w' \in [1, w - 1]$ を選び、その直線を横切るすべての紙片を切断します。したがって、異なる高さで $c_h$ 回の水平切断を行い、異なる幅で $c_w$ 回の垂直切断を行うと、最終的に $(c_h + 1)(c_w + 1)$ 枚の紙片が得られます。

今 Hitagi は、最終的に得られるすべての長方形の紙片の面積が $s$ 以下になるようにするために必要な最小の切断回数がいくつであるか気になっています。

$t$ 個の組 $h, w, s$ について答えを求めてください。

入力

最初の行には整数 $t$($1 \le t \le 1\,000$)が与えられます — 解くべきテストケースの数です。

続く $t$ 行には整数の組 $h, w, s$($1 \le h, w, s \le 10^9$)が与えられます — 紙の寸法と目標の面積です。

出力

$t$ 行を出力してください。各行には組に対する答えである 1 つの整数を含めてください。

入出力例

入力例 1

5
2 2 1
1 7 2
4 4 17
4 4 15
120 216 34

出力例 1

2
3
0
1
55

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#366EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.