Skip to content

Add 0041 #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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.