#P4904. 排版
排版
Description
However, student XHY does not know how to make a PowerPoint, so she asked the expert CYD for help. She wants to tile photos of size without overlap and without gaps into a single rectangle to use as a background image. For aesthetics, she wants the rectangle’s width and height to be as close as possible (i.e., minimize their absolute difference). Among all arrangements that achieve this minimum difference, the number of rotated photos should be as small as possible. Photos may only be (not counted as rotated) or (counted as rotated).
Please help CYD write a program to design such an arrangement for XHY that meets these requirements and uses the fewest rotated photos.
Input Format
The first line contains a positive integer .
Output Format
Output a single non‑negative integer — the minimal number of rotated photos.
6
0
7
3
Hint
- For 20% of the testdata, .
- For 30% of the testdata, .
- For 50% of the testdata, .
- For 70% of the testdata, .
- For 100% of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号