Universal Cup Judging System

Universal Cup

时间限制: 3.0 s 内存限制: 256 MB 总分: 100 可 Hack ✓
统计

Hitagi Senjougahara 有一張高度為 $h$、寬度為 $w$ 的紙。這張紙被劃分為 $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.