151 words
1 minute
TCTT25 Programming: ShapesofYou
ShapesofYou - Programming Challenge
โจทย์
Challenge นี้เป็นโจทย์ Programming ที่ใช้ Python เกี่ยวกับ shapes/geometry
ดาวน์โหลดไฟล์
| ไฟล์ | ดาวน์โหลด |
|---|---|
| create.py | 📥 Download |
| output.txt | 📥 Download |
| All Files | 📦 GitHub Folder |
ไฟล์ที่ได้รับ
create.py
import randomfrom libnum import s2n
def print_triangle(n: int): for i in range(1, n + 1): print("*" * i)
def print_square(n: int): for _ in range(n): print("*" * n)
def print_circle(r: int): for y in range(-r, r + 1): line = "" for x in range(-r, r + 1): if x * x + y * y <= r * r: line += "*" else: line += " " print(line)
flag=b'hidden_msg'
N=s2n(flag)
oct_N=oct(N)l=list(str(oct_N)[2:])for i in range(len(l)): n=int(l[i])
if n==0: print('#0#')
else: c=random.randrange(1, 4) if c == 1: print_triangle(n) elif c == 2: print_square(n) else: print_circle(n)output.txt
ไฟล์ output.txt มีขนาดใหญ่ สามารถดาวน์โหลดได้จากลิงก์ด้านบน
แนวทางวิเคราะห์
- อ่านโค้ด
create.pyเพื่อเข้าใจการสร้าง output - วิเคราะห์ output.txt หา pattern ของ shapes - นับจำนวนแถวของ triangle, square หรือ circle
- เขียน solver เพื่อแปลงกลับจาก shape เป็นตัวเลข octal แล้วแปลงเป็น string
Tools ที่อาจใช้
| Tool | วัตถุประสงค์ |
|---|---|
| Python | รันและแก้โค้ด |
| matplotlib | Visualize shapes (ถ้าจำเป็น) |
สถานะ
⏳ รอ Writeup - Challenge นี้ยังไม่มี writeup อย่างละเอียดใน repository
Credits
Challenge from TCTT25 | GitHub Repo
TCTT25 Programming: ShapesofYou
https://blog.lukkid.dev/posts/tctt25-prog-shapesofyou/