Universal Cup Judging System

Universal Cup

Límite de tiempo: 3.0 s Límite de memoria: 256 MB Puntuación total: 100 Hackeable ✓
Estadísticas

ל-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.