Tangram
Ghép 7 mảnh xoay & lật
Luyện tập / Chủ đề Logic · Tư duy
Bài tập suy luận logic, nhận diện quy luật, bài toán cân đo, câu đố chiến thuật và tư duy thuật toán.
Đăng nhập để lưu tiến độ và tích lũy điểm trên bảng xếp hạng.
Phòng thí nghiệm có $64$ bình dung dịch trong suốt đánh số từ $0$ đến $63$, trong đó có đúng $1$ bình bị nhiễm tạp chất. Bạn có các que thử đặc biệt: có thể nhỏ chung nhiều giọt từ các bình khác nhau lên cùng một que thử; sau đúng $60$ phút, que thử sẽ chuyển sang màu tím nếu hỗn hợp nhỏ lên nó có chứa giọt từ bình nhiễm tạp chất (ngược lại que giữ màu trắng). Vì chỉ còn đúng $60$ phút trước giờ báo cáo (chỉ kịp chờ phản ứng một đợt duy nhất), bạn cần dùng ít nhất bao nhiêu que thử để xác định chắc chắn bình nào bị nhiễm tạp chất?
Đáp án: $6$
Lối mòn dễ mắc: Xếp $64$ bình thành bảng vuông $8 \times 8$ rồi thử theo $8$ hàng và $8$ cột vẫn mất tới $8 + 8 = 16$ que thử!
Đổi câu hỏi (Chìa khóa): Sau $60$ phút, mỗi que thử mang $1$ bit thông tin (Trắng $= 0$, Tím $= 1$). Hãy mã hóa số thứ tự từ $0$ đến $63$ sang hệ nhị phân!
Lời giải gọn đẹp:
$$2^k \geqslant 64 \iff k \geqslant 6\text{ (vì } 2^6 = 64\text{)}.$$
[Part C · Hard] A Quadtree compresses a $2^k \times 2^k$ black-and-white image recursively:
How many total nodes (counting both internal nodes and leaf nodes) are in the Quadtree of this $4 \times 4$ image?
Cây tứ phân (Quadtree) nén ảnh đen trắng $2^k \times 2^k$ theo quy tắc đệ quy:
Hỏi cây Quadtree của bức ảnh $4 \times 4$ dưới đây có tổng cộng bao nhiêu nút (tính cả nút trong lẫn nút lá)? (Chỉ điền số)
Đáp án: $9$
Answer / Đáp án: 9
Step-by-step (EN): 1) Whole $4 \times 4$ has mixed colors $\to$ $1$ root node, split into four $2 \times 2$ quadrants:
11 / 11): uniform dark $\to$ $1$ leaf node.00 / 00): uniform white $\to$ $1$ leaf node.11 / 11): uniform dark $\to$ $1$ leaf node.00 / 01): mixed! $\to$ $1$ internal node + $4$ single-pixel leaf nodes ($1 + 4 = 5$ nodes).Total nodes $= 1 + 1 + 1 + 1 + 5 = 9$.
Giải chi tiết (VI): 1) Toàn ảnh $4 \times 4$ lẫn hai màu $\to$ tạo $1$ nút gốc và chia thành $4$ góc $2 \times 2$:
11 / 11): đồng màu đen $\to$ $1$ nút lá.00 / 00): đồng màu trắng $\to$ $1$ nút lá.11 / 11): đồng màu đen $\to$ $1$ nút lá.00 / 01): lẫn màu $\to$ $1$ nút trong chia tiếp thành $4$ nút lá $1 \times 1$ ($5$ nút).Tổng số nút $= 1 + 1 + 1 + 1 + 5 = 9$ nút.
Computational Thinking / Tư duy Máy tính: Quadtree Spatial Indexing & Hierarchical Compression (Cây tứ phân nén không gian ảnh).
[Part C · Hard] A cache holds at most $3$ pages using the Least Recently Used (LRU) eviction policy: whenever a requested page is not in the cache and the cache is full, the page that was accessed longest ago is evicted. Starting from an empty cache, the CPU requests pages in order:
A, B, C, A, D, B, E.
Which $3$ pages remain in the cache at the end?
Bộ nhớ đệm (cache) chứa tối đa $3$ trang theo chiến lược LRU (Least Recently Used): khi cần nạp trang mới mà bộ đệm đã đầy, trang lâu nhất chưa được truy cập sẽ bị đẩy ra. Ban đầu bộ đệm rỗng, CPU lần lượt truy cập các trang: A, B, C, A, D, B, E. Ba trang nào nằm trong bộ đệm ở cuối dãy?
Đáp án: {B, D, E}
Answer / Đáp án: {B, D, E}
Step-by-step (EN): Track cache ordered from Least Recently Used $\to$ Most Recently Used:
1) A: [A]
2) B: [A, B]
3) C: [A, B, C]
4) A (hit! refresh A): [B, C, A]
5) D (miss, evict LRU B): [C, A, D]
6) B (miss, evict LRU C): [A, D, B]
7) E (miss, evict LRU A): [D, B, E].
Giải chi tiết (VI): Theo dõi thứ tự trong cache từ dùng lâu nhất $\to$ vừa mới dùng:
1–3) Nạp A, B, C: [A, B, C]
4) Gọi lại A (trúng cache, A lên mới nhất): [B, C, A]
5) Nạp D (đẩy B ra): [C, A, D]
6) Nạp B (đẩy C ra): [A, D, B]
7) Nạp E (đẩy A ra): còn {B, D, E}.
Computational Thinking / Tư duy Máy tính: Operating Systems — LRU Cache Replacement Algorithm (Thuật toán thay thế trang LRU).
Three routes reach a charging station. Their separate segment lengths are 6 + 6; 8 + 3; 11 + 2. What is the shortest route length?
Đáp án: $11$
Cộng các đoạn trên từng tuyến được 12, 11, 13. Chọn tổng nhỏ nhất.
A file stores this row of pixels: ######...##. It writes two symbols per uninterrupted run: its count and its color. How many symbols does it write?
Đáp án: $6$
Có ba đoạn liên tiếp cùng màu. Mỗi đoạn dùng hai ký hiệu, tổng cộng sáu ký hiệu.
There are $75$ pebbles on a table. An and Binh take turns removing $1$ to $5$ pebbles per turn (An goes first). The player who takes the last pebble wins. How many pebbles must An take on the first move to guarantee a win?
Trên bàn có $75$ viên sỏi. An và Bình luân phiên bốc sỏi (An đi trước), mỗi lượt được bốc từ $1$ đến $5$ viên. Người bốc được viên sỏi cuối cùng thắng. Để chắc chắn thắng theo chiến thuật tối ưu, ở nước đầu tiên An phải bốc bao nhiêu viên?
Đáp án: $3$
Chiến thuật đưa số sỏi còn lại về bội của $(m + 1) = 6$. Vì $75 \equiv 3 \pmod{6}$, An bốc đúng $3$ viên ở nước đầu tiên.
There are $81$ pebbles on a table. An and Binh take turns removing $1$ to $6$ pebbles per turn (An goes first). The player who takes the last pebble wins. How many pebbles must An take on the first move to guarantee a win?
Trên bàn có $81$ viên sỏi. An và Bình luân phiên bốc sỏi (An đi trước), mỗi lượt được bốc từ $1$ đến $6$ viên. Người bốc được viên sỏi cuối cùng thắng. Để chắc chắn thắng theo chiến thuật tối ưu, ở nước đầu tiên An phải bốc bao nhiêu viên?
Đáp án: $4$
Chiến thuật đưa số sỏi còn lại về bội của $(m + 1) = 7$. Vì $81 \equiv 4 \pmod{7}$, An bốc đúng $4$ viên ở nước đầu tiên.
Four cards have the numbers $2, 5, 7, 12$ on their fronts, and the four labels “divisible by $7$”, “prime”, “odd”, and “greater than $100$” on their backs. On every card, the back label is FALSE for the front number. Which number is on the card labeled “greater than $100$”?
Đáp án: $7$
Four cards have the numbers $2, 5, 11, 14$ on their fronts, and the four labels “divisible by $11$”, “prime”, “odd”, and “greater than $50$” on their backs. On every card, the back label is FALSE for the front number. Which number is on the card labeled “odd”?
Đáp án: $2$
On an island live knights (who always tell the truth) and knaves (who always lie). $12$ islanders stand in a row from left to right. Every islander says: “There are more knaves to my left than knights to my right.” How many knights are in the row?
Đáp án: $6$
Four cards have the numbers $2, 3, 13, 18$ on their fronts, and the four labels “divisible by $13$”, “prime”, “odd”, and “negative” on their backs. Every back label is FALSE for its front number. Which number is on the card labeled “prime”?
Đáp án: $18$
A sequence of $2026$ numbers begins with $3, 5, \dots$, and from the $3$rd term onward, each term equals the previous term minus the term before that ($a_n = a_{n-1} - a_{n-2}$). What is the sum of all $2026$ terms?
Đáp án: $7$
Four cards have the numbers $2, 7, 19, 20$ on their fronts, and the four labels “divisible by $19$”, “prime”, “odd”, and “greater than $99$” on their backs. Every back label is FALSE for its front number. Which number is on the card labeled “divisible by $19$”?
Đáp án: $7$
Five positive integers are written in a row: the first is $3$ and the fifth is $15$. The product of the first three numbers is $60$, the product of the middle three is $120$, and the product of the last three is $450$. What is the middle ($3$rd) number?
Đáp án: $5$
Four cards have the numbers $2, 5, 23, 24$ on their fronts, and the four labels “multiple of $23$”, “prime”, “odd”, and “three-digit number” on their backs. Every back label is FALSE for its front number. Which number is on the card labeled “three-digit number”?
Đáp án: $23$