2012年四川理工学院“达内杯”大学生程序设计竞赛试题Problem 1:SortingThere are 16 random sorting numbers from 0 to 15, and they could be converted to different binary numbers, which have 4 digits. Please code algorithm to sort them by the order that the first there digits of the former number is same to the last there digits of the following. The first number of the sorted is always the first given number. Sample Input:1 3 5 7 9 11 13 15 02 4 6 8 10 12 14Sample Output:1 2 4 9 3 7 15 14 13 10 5 11 6 12 8 0Problem 2:Solution of EquationIn the interval [0,1], please programming to give the real root, of which error is less than 10-3, of equation ax3+bx2+cx+d=0, where a, b ,c and d are real number. And print the real root or the character “no solution”.Sample Input:1:a =1 b =-1 c =-2 d =12:a =1 b =1 c =1 d =1Sample Output:1:x =0.4443359372:no solutionProblem 3:The TriangleDescription73 88 1 02 7 4 44 5 2 6 5(Figure 1 Number Triangle)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right.InputYour program is to read from standard input. The first line contains one integer n: the number of rows in the triangle. The following n lines describe the data of the triangle. The number of rows in the triangle is >= 1 but <= 100. The numbers in the triangle, all integers, are between 0 and 99.OutputYour program is to write to standard output. The highest sum is written as an integer. Sample Input573 88 1 02 7 4 44 5 2 6 5Sample Output30Problem 4:Common SubsequenceDescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = {x1, x2, ..., x m }, another sequence Z = { z1, z2, ..., z k } is a subsequence of X if there exists a strictly increasing sequence { i1, i2, ..., i k } of indices of X such that for all j = 1,2,...,k, z j= x ij. For example, Z = { B, C, D,B } is a subsequence of X = { A, B, C, B, D, A, B } with index sequence { 2, 3, 5, 7 }. Given two sequences X and Y ,the problem is to find the length of the maximum-length common subsequence of X and Y.InputThe program input is from the std input. Each data set in the input contains two strings representing the given sequences. The sequences are separated by any number of white spaces. The input data are correct.OutputFor each set of data, the program prints on the standard output the length of the maximum-length common subsequence from the beginning of a separate line. Sample InputABCFBC ABFCABPROGRAMMING CONTESTABCD MNPSample Output42Problem 5:When Can We Meet?The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange their schedules for the meeting. So, in order to settle the meeting date, the chairperson requested every member to send back a list of convenient dates by E-mail. Your mission is to help the chairperson, who is now dedicated to other issues of the contest, by writing a program that chooses the best date from the submitted lists. Your program should find the date convenient for the most members. If there is more than one such day, the earliest is the best.InputThe input has multiple data sets, each starting with a line containing the number of committee members and the quorum of the meeting.N QHere, N, meaning the size of the committee, and Q meaning the quorum, are positive integers. N is less than 50, and, of course, Q is less than or equal to N.N lines follow, each describing convenient dates for a committee member in the following format.M Date1 Date2 ... DateMHere, M means the number of convenient dates for the member, which is an integer greater than or equal to zero. The remaining items in the line are his/her dates of convenience, which are positive integers less than 100, that is, 1 means tomorrow, 2 means the day after tomorrow, and so on. They are in ascending order without any repetition and separated by a space character. Lines have neither leading nor trailing spaces.A line containing two zeros indicates the end of the input.OutputFor each data set, print a single line containing the date number convenient for the largest number of committee members. If there is more than one such date, print the earliest. However, ifno dates are convenient for more than or equal to the quorum number of members, print 0 instead. Sample Input3 22 1 43 34 83 24 15 8 93 2 5 95 2 4 5 7 93 32 1 43 2 5 92 2 43 32 1 23 1 2 92 2 40 0Sample Output452Problem 6:Frame Polygonal LineYou are going to read a sequence of pairs of integer numbers. Each pair represents the Cartesian coordinates of a point in a 2-dimentional plane. The first number is the x coordinate, while the second is that of y. The sequence represents a polygonal line. Your task is to draw a rectangle with minimal length of sides that exactly surrounds the polygonal line. The sides of the rectangle are parallel to x- and y-axis, respectively.InputInput consists of several test cases. For each case, a sequence of coordinates is given. Each pair of x and y occupies a line, with |x| and |y| less than 2^31. The sequence is terminated with a pair of 0's. Note that (0, 0) will never be considered as a point on any of the polygonal lines. An empty polygonal line signals the end of input.OutputFor each test case, print in one line two pairs of numbers, which are the south-west and north-east corners of the surrounding rectangle. The numbers must be separated by one space as is indicated in the samples.Sample Input12 5623 5613 100 012 340 00 0Sample Output12 10 23 5612 34 12 34Problem 7:The Symbolic NumDescriptionWe represent a decimal numbers use the ten Arabic numeral 0~9 , but some people who live in a faraway tribe representing number use three marks …*‟,‟#‟,and …-… . The three marks represent the value 0, 1 and -1 respective. And In their system, every digital is three times larger than the digital on the right. So, the number ‘#*-‘ is 8 (because 8=1×9+0×3+-1×1),and the num‘-#’ is -2 ( -2= -1×3+1×1 ).Now you are request to program to read a number between -231~231-1 and output the form that used in the tribe.InputOne decimal number every lineOutputThe string that represent the number used in the tribe corresponding to the input Sample Input102-1742-2147483648Sample Output#*##--#*##---*-#*##*#***##---#-#--#----------------------------------------------------------------------------------------------------------------------#include<stdio.h>main(){int}Problem 8:Target numberYou get five integers as the operand, and another integer as the target number. Now you are required to perform proper arithmetic operation use the five numbers to let the result great than or equal the target number. And we need the optimalizing result which is the most close to the target number. You can use + - * / and ( ) to caculate, and all the intermediate result are required be integer , so some division is illegal. ( such as (2*2)/4 is legal , and 2*(2/4) is illegal. )InputThere is only one line which has 6 numbers in the input file. The front five numbers are operand Mi, 1<=Mi<=100, the last number is the target number T, 1<=T<=1000.OutputOnly one number, is the optimize targetSample input:1 2 3 7 100 573Sample output:573。