390 likes | 492 Views
张培超 2008-2009(Seed) Jakarta 2 nd Chengdu 13 th bbsID: failedstar. starforever00@gmail.com. Funny Problems for Beginners. Peichao Zhang. SGU 238. Uncle Vasya and Bags for Potatoes. Problem Statement. N different bags some bags on the floor some bags in the other bags
E N D
张培超 2008-2009(Seed) Jakarta 2nd Chengdu 13th bbsID: failedstar starforever00@gmail.com
Funny Problems for Beginners Peichao Zhang
SGU 238 Uncle Vasya and Bags for Potatoes
Problem Statement • N different bags • some bags on the floor • some bags in the other bags • one can do the following operation at each turn
Problem Statement • select some bag and open it • put all other bags originally on the floor into the selected bag • pour all bags originally inside the selected bag to the floor
Problem Statement • question • if we repeatedly perform the above operation • how many different layouts of bags can we get?
A Stragithforward Solution • devise a way to represent the layout of bags • maintain a collection of layouts that have been expanded • simulate the above operation on each layout to expand the collection • count the number of layouts in the collection
A Smart Solution • just print N+1 • why?
Solution Analysis • tree structure
Solution Analysis • 2 operations on the same bag = nothing changed • number of operations = number of bags on the floor • if we choose a bag, we cannot choose other bags originally on the floor after the operation
Solution Analysis • relation • layout tree node • operation tree edge
SGU 251 polymania
Problem Statement • N points (N>=3) • each point has a positive special number • at least two points have the same special number
Problem Statement • try to arrange the points in a Cartesian coordinate, so that for each triangle formed by 3 different points, the area of the triangle equals the sum of the special number associated with each point
Problem Statement 2 2 1 1
Solution Analysis • how to utilize the condition “at least two points have the same special number”?
X=Y A X B C
Solution Analysis • we can conclude from this condition that for any N>4, no solution exists!
Solution Analysis • so we need only consider the situation when N=3 and N=4 • when N=3, we can construct a solution easily • when N=4, we can also construct a solution with some calculations
Solution Analysis X Y XAB=YAB XYA=XYB A B
Solution Analysis X XAB=YAB XYA+XYB=XAB+YAB A B Y
Solution Analysis X XAB=YAB XYA-XYB=XAB+YAB A B Y
Solution Analysis • for N=4, we can calculate the areas of all the 4 triangulars • we can choose to apply one position layout above that satisfying the corresponding equations
SGU 246 Black & White
Problem Statement • a necklace with 2N-1 beads • K of them are black, the rest are white • the necklace is “beautiful” if there exists two black beads such that exactly N beads are between them
Problem Statement • find the minimal K, such that the necklace will always be “beautiful” • regardless of how the beads are arranged
N=4 K=4
Solution Analysis • try to make the situation as worst as possible • that is, try to maximize the number of black beads, and keep the necklace “ugly” • two beads with the distance of N+1 in a circular manner cannot be black at once
Solution Analysis • construct a graph of 2N-1 nodes, each representing a bead • for any two beads that cannot be black at once, connect the corresponding nodes with an edge in the graph • try to paint as many nodes as possible black, such that no two nodes are adjacent to each other
Solution Analysis • with some math analysis • when 2N-1 = 0 (mod 3), the graph is composed of 3 circles • otherwise, the graph is just a circle • the proof is not difficult, so we omit it here
Solution Analysis • finally, with some basic calculations, we end up with a fairly simple answer for the problem • when 2N-1 = 0 (mod 3), the answer is N-1, otherwise the answer is N
Q&A Thanks!