UVa

UVa 307. Sticks

Description George 拿了一些相同長度的棍子,然後隨意的把這些棍子切成一段一段的棍子(每段長度都不會超過 50 個單位長)。現在他想要把這些一段一段的棍子拼回原來的樣子,但是他忘了他原來帶多少根棍子來,並且也忘了原來每根棍子的長度。請幫助他設計一個程式算出這些棍子原來可能的最小長度。所有的棍子長度都是整數,並且大於 0。
2018-08-06

UVa 10952. Pattern Transformations

Description Consider the two patterns of ‘O’ and ‘X’ below (‘.’ represent an empty square). We want the first pattern to be transformed into the second pattern in one time unit. During this time unit, each symbol (‘O’ and ‘X’) can move one step in any of the four directions (or remain at its current square). All movements happen simultaneously, so a symbol can move to an occupied square, if that symbol is moved to some other square. If a symbol moves from square A to B, and the symbol at B moves to A, we have a swap. Write a program which calculates the least number of swaps needed to transform a given pattern into another given pattern.
2018-08-06

UVa 103. Stacking Boxes

Description 在數學或電腦科學裡,有些概念在一維或二維時還蠻簡單的,但到 N 維就會顯得非常複雜。試想一個 n 維的「盒子」:在二維空間裡,盒子 ( 2 , 3 ) 可代表一個長為 2 個單位,寬為 3 個單位的盒子;在三維空間裡,盒子 ( 4 , 8 , 9 ) 則是一個 4*8*9(長、寬、高)的盒子。至於在六維空間裡,也許我們不清楚 ( 4 , 5 , 6 , 7 , 8 , 9 ) 長得怎樣,不過我們還是可以分析這些盒子的特性。
2018-08-06