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.