code-golf

Code Golf: Frobenius Number

拥有回忆 提交于 2019-12-20 12:18:46
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Write the shortest program that calculates the Frobenius number for a given set of positive numbers. The Frobenius number is the largest number that cannot be written as a sum of positive multiples of the numbers in the set. Example: For the set of the Chicken McNugget TM sizes [6,9,20] the Frobenius number is 43, as

Code Golf: Prime Factors of a Number [closed]

谁说胖子不能爱 提交于 2019-12-20 10:23:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Closed 3 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. What is the shortest way , by character count, to find prime factors in any number? Example Input: 1806046 Example Output: 2x11x11x17x439 Example Calculator 回答1: C#, 69 x is input number int i=2;while(x>1)if(x%i++==0){x/=--i

Code Golf: Playing Tetris

喜夏-厌秋 提交于 2019-12-20 08:08:52
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The basics: Consider the following tetrominoes and empty playing field: 0123456789 I O Z T L S J [ ] [ ] # ## ## ### # ## # [ ] # ## ## # # ## # [ ] # ## ## [ ] # [ ] [==========] The dimensions of the playing field are fixed. The numbers at the top are just here to indicate the column number (also see input). Input: 1

Convert a string into Morse code [closed]

爷,独闯天下 提交于 2019-12-18 10:14:31
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The challenge The shortest code by character count, that will input a string using only alphabetical

Code Golf: Four is magic

核能气质少年 提交于 2019-12-18 10:02:14
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The puzzle A little puzzle I heard while I was in high school went something like this... The questioner would ask me to give him a number; On hearing the number, the questioner would do some sort of transformation on it repeatedly (for example, he might say ten is three ) until eventually arriving at the number 4 (at

Code Golf: Running Water

霸气de小男生 提交于 2019-12-18 10:01:32
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The challenge The shortest code by character count to identify and mark water depressions in the ASCII representation of a land from input. Input will be an ASCII representation of a landscape, having hills, valleys and flat lands. The program should simulate what the landscape would look like if if was flooded -

The Skyline Problem‍​​

大城市里の小女人 提交于 2019-12-18 09:54:26
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I just came across this little problem on UVA's Online Judge and thought, that it may be a good candidate for a little code-golf. The problem: You are to design a program to assist an architect in drawing the skyline of a city given the locations of the buildings in the city. To make the problem tractable, all buildings

Code Golf: Print the entire “12 Days of Christmas” song in the fewest lines of code

痴心易碎 提交于 2019-12-17 23:44:17
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. Print all 12 verses of the popular holiday song. By 12 verses I mean the repetition of each line as is sung in the song, ie Verse One: On the first day of Christmas my true love gave to me a partridge in a pear tree. Verse Two On the second day of Christmas my true love gave to me two turtle doves and a partridge in a

Creating the shortest Turing-complete interpreter [closed]

强颜欢笑 提交于 2019-12-17 21:47:11
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I've just tried to create the smallest possible language interpreter. Would you like to join and try?

Code Golf: Numeric equivalent of an Excel column name

て烟熏妆下的殇ゞ 提交于 2019-12-17 15:26:11
问题 Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. The challenge The shortest code by character count that will output the numeric equivalent of an Excel column string. For example, the A column is 1, B is 2, so on and so forth. Once you hit Z , the next column becomes AA , then AB and so on. Test cases: A: 1 B: 2 AD: 30 ABC: 731 WTF: 16074 ROFL: 326676 Code count