********************************************************************** BRONZE PROBLEMS ********************************************************************** Four problems numbered 11 through 14 ********************************************************************** Problem 11: Powers of Two [Traditional, 2005] Given an integer N (0 <= N <= 265), print exactly value of 2 to the Nth power (with no leading zeroes or spaces, of course). PROBLEM NAME: ptwo INPUT FORMAT: * Line 1: The integer N SAMPLE INPUT (file ptwo.in): 100 OUTPUT FORMAT: * Line 1: A single line that contains 2 to the Nth power. SAMPLE OUTPUT (file ptwo.out): 1267650600228229401496703205376 ********************************************************************** Problem 12: Cow Similarity [Mathijs Vogelzang, 2005] Farmer John has N (2 <= N <= 50) different cows numbered 1..N and wants to know which two appear most similar to each other. He has made 5x7 digital photographs of each of his cows and wants you to write a program to compare them. The 5x7 photos show the black and white spot pattern of a cow. Below are the photos of two different cows ('X' represents a black part; '.' represents a white part): Cow 1 Cow 2 ..X.... ...X... .XXX... ..XX... .XX.... .XX.... .....X. .XX..X. .X...X. .X...X. To compare these two cows, every spot in corresponding squares is checked. Each spot that is the same gets one 'similarity point'. The two cows above score 30 'similarity points' because only five of the corresponding squares are different (see '#' below): ++##+++ +#+++++ +++++++ +##++++ +++++++ Given a set of cows, find the two that are most similar and print their two ID numbers in ascending order. It is guaranteed that only one pair of cows has the highest similarity score. PROBLEM NAME: likecow INPUT FORMAT: * Line 1: N, the number of cows * Lines 2..N*5+1: The digital photographs of the cows, with cow i appearing on line i*5-3 to line i*5+1. See the sample below. SAMPLE INPUT (file likecow.in): 3 ..X.... .XXX... .XX.... .....X. .X...X. ...X... ..XX... .XX.... .XX..X. .X...X. XX..... X...... XX...XX XXXX.XX XXX..XX INPUT DETAILS: The two sample cows, plus one extra cow OUTPUT FORMAT: * Line 1: The two cows having the maximum similarity score, in ascending order SAMPLE OUTPUT (file likecow.out): 1 2 OUTPUT DETAILS: The third cow has a similarity of score of 16 and 19 with cow 1 and 2 respectively, both lower than the similarity score of 30 between cow 1 and 2 ********************************************************************** Problem 13: Linear Sequences [Traditional, 2005] A linear sequence is an ordered triple (s1,s2,s3) where the difference s2-s1 is the same as the difference s3-s2. Examples include: (1,2,3), (2,4,6), and (14,21,28). Given a sorted set of S (3 <= S <= 30) unique integers in the range 1..100, count the number of linear sequences formed by all the possible triples. PROBLEM NAME: lseq INPUT FORMAT: * Line 1: A single integer, S * Line 2: S space-separated integers SAMPLE INPUT (file lseq.in): 7 1 2 3 4 6 8 9 OUTPUT FORMAT: * Line 1 : A single integer that is the number of linear subsequences. The integer is guaranteed to fit into a signed 32-bit integer. SAMPLE OUTPUT (file lseq.out): 5 OUTPUT DETAILS: These are the sequences: 1 2 3 2 3 4 2 4 6 3 6 9 4 6 8 ********************************************************************** Problem 14: No Linear Sequences [Richard V. Andree, 1966] A linear sequence is an ordered triple (s1,s2,s3) where the difference s2-s1 is the same as the difference s3-s2. Examples include: (1,2,3), (2,4,6), and (14,21,28). Given L (4 <= L <= 13), the size of an ordered set of integers, and M (L < M <= 35), the maximum possible integer in the set, find all the ordered sets with L integer elements in the range 1..M such that no three of the set's elements form a linear sequence. Your program should print the 'first' three of these sets (or fewer than three if there are not three) where sets are compared element-by-element (such that, e.g., the set {1, 2, 4} precedes {1, 3, 4}). The final output line is the total number of sequences with no linear subsequences. Do not use pre-calculation to solve this problem. PROBLEM NAME: nls INPUT FORMAT: * Line 1: Two space-separated integers: L and M SAMPLE INPUT (file nls.in): 5 9 INPUT DETAILS: Sets of length 5 whose integers are in the range 1..9 OUTPUT FORMAT: * Lines 1..3?: Each of the lines should contain L sorted, space-separated integers with no linear subsequences. * Line 4?: The final line of the output is a single integer that is the count of the number of sequences with no linear subsequences. It is guaranteed that this number fits in a signed 32-bit integer. SAMPLE OUTPUT (file nls.out): 1 2 4 8 9 1 2 6 7 9 1 2 6 8 9 4 OUTPUT DETAILS: The fourth one is: 1 3 4 8 9 **********************************************************************