A box contains socks of $3$ different colors (at least $10$ of each). What is the minimum number of socks to draw in the dark to guarantee at least $3$ socks of the same color?
Xem đáp án và lời giải
Đáp án: $7$
Theo nguyên lý Dirichlet, số tất ít nhất phải lấy là $3 \times (3 - 1) + 1 = 7$.
A dark drawer contains $9$ red socks, $9$ blue socks, $9$ green socks, and $2$ more color(s) with $9$ socks each (5 colors in total). What is the minimum number of socks you must pull out without looking to guarantee a matching pair?
Xem đáp án và lời giải
Đáp án: $6$
Theo nguyên lý Dirichlet, trong trường hợp xấu nhất ta rút được $5$ chiếc khác màu nhau. Chiếc thứ $6$ chắc chắn trùng màu với một chiếc đã rút.
[Part B · Medium] Data packets travel along one-way fiber links from server S to server T. Each number shows the transmission delay in milliseconds (ms). What is the minimum total delay (in ms) from S to T?
Các gói dữ liệu truyền theo đường cáp quang một chiều từ máy chủ S tới máy chủ T với độ trễ (tính bằng ms) ghi trên mỗi cạnh. Độ trễ nhỏ nhất (tính bằng ms) để truyền gói tin từ S đến T là bao nhiêu? (Chỉ điền số)
Xem đáp án và lời giải
Đáp án: $9$
Answer / Đáp án: 9
Step-by-step (EN): Compute shortest distances from S (Dijkstra):
d(S) = 0
d(B) = 2
d(A) = min(5, d(B)+2) = 4 (via S -> B -> A)
d(C) = min(d(A)+3, d(B)+5) = min(7, 7) = 7
d(D) = d(B)+6 = 8
d(T) = min(d(C)+4, d(D)+1) = min(11, 9) = 9 (via S -> B -> D -> T $= 2 + 6 + 1 = 9\text{ ms}$!).
Giải chi tiết (VI): Tính khoảng cách ngắn nhất từ S:
S -> B -> A -> C -> T mất $2 + 2 + 3 + 4 = 11\text{ ms}$.
S -> B -> C -> T mất $2 + 5 + 4 = 11\text{ ms}$.
S -> B -> D -> T mất $2 + 6 + 1 = 9\text{ ms}$!
Vậy độ trễ nhỏ nhất là $9\text{ ms}$.
Computational Thinking / Tư duy Máy tính:Dijkstra's Shortest-Path Algorithm (Thuật toán đường đi ngắn nhất Dijkstra).
[Part B · Medium] A drone courier carries a backpack that holds at most $10\text{ kg}$. Four parcels are waiting:
Parcel
Weight
Reward
P1
$6\text{ kg}$
$13$ coins
P2
$5\text{ kg}$
$11$ coins
P3
$4\text{ kg}$
$9$ coins
P4
$3\text{ kg}$
$7$ coins
Each parcel can be taken at most once. What is the maximum total reward the drone can earn in a single trip?
Parcel
Weight
Reward
P1
$6\text{ kg}$
$13$ coins
P2
$5\text{ kg}$
$11$ coins
P3
$4\text{ kg}$
$9$ coins
P4
$3\text{ kg}$
$7$ coins
Một drone giao hàng mang được tối đa $10\text{ kg}$. Có $4$ kiện hàng với khối lượng và tiền thưởng như bảng trên (mỗi kiện chỉ lấy tối đa $1$ lần). Tổng tiền thưởng lớn nhất mà drone nhận được trong một chuyến bay là bao nhiêu xu?
Xem đáp án và lời giải
Đáp án: $22$ coins
Answer / Đáp án: $22$ coins
Step-by-step (EN): Check valid subsets with total weight $\leqslant 10\text{ kg}$:
In sorting task #3, a list of $7$ distinct numbers is in completely reverse order. What is the minimum number of adjacent swaps needed to sort it into increasing order?
Xem đáp án và lời giải
Đáp án: $21$
Số cặp nghịch thế tối đa của dãy $7$ phần tử là $\dfrac{7(6)}{2} = 21$.