Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions md/0041.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
พิจารณาเมื่อ $K$ เป็นเลขคู่ เนื่องจากเส้นผ่านศูนย์กลางของวงกลมแต่ละวงเป็น 2 เราเลยรู้ว่าไม่วิธีที่จะจัดวงกลมมากกว่า $K$ วงลงในพื้นที่สี่เหลี่ยมขนาด $4 \times K$ ตามรูป
![](../media/0041/evenFullPack.png)
ดังนั้นเมื่อให้ $N$ เลขคู่มา คำตอบคือ $K = N$

ส่วนสำหรับ $N$ ที่เป็นเลขคี่จะต้องแยกพิจารณาเป็นสามกรณี
1. เมื่อ $N = 1$ เราจะได้ว่ารูปที่เล็กที่สุดเป็น $4 \times 2$ ดังรูป
![](../media/0041/oneFullPack.png)
2. เมื่อ $N = 3$ เราจะได้ว่ารูปที่เล็กที่สุดเป็น $4 \times (2 + \sqrt 3)$ ดังรูป
![](../media/0041/threeFullPack.png)
3. เมื่อ $N \ge 5$ เราจะได้ว่ารูปที่เล็กที่สุดเป็น $4 \times (N-3 + 2\sqrt 3)$ ดังรูป
![](../media/0041/oddFullPack.png)

```cpp
int n; cin >> n;
cout << fixed << setprecision(6);
if (n == 1) cout << 2.0;
else if (n == 3) cout << 2 + sqrt(3);
else cout << n + (n&1)*(2*sqrt(3)-3);
```
Binary file added media/0041/evenFullPack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/0041/oddFullPack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/0041/oneFullPack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/0041/threeFullPack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.