跳到主要內容

發表文章

UVA10057

Problem C A mid-summer night’s dream Input:  standard input Output:  standard output This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here because this problem is being sent back to 2000AD with the help of time machine. Now it is possible to establish direct connection between man and computer CPU. People can watch other people’s dream on 3D displayer (That is the monitor today) as if they were watching a movie. One problem in this century is that people have become so dependent on computers that their analytical ability is approaching zero. Computers can now read problems and solve them automatically. But they can solve only difficult problems. There are no easy problems now. Our chief scientist is in great trouble as he has forgotten the number of his combination lock. For security reasons computers today cannot solve combination lock related problems. In a mid-summer night the scientist has a dream where he se...

UVA10242

Problem G Fourth Point!! Input:  standard input Output:  standard output Time Limit:  2 seconds Memory Limit:  32 MB Given are the  (x, y)  coordinates of the endpoints of two adjacent sides of a parallelogram. Find the  (x, y)  coordinates of the fourth point. Input Each line of input contains eight floating point numbers: the  (x, y)  coordinates of one of the endpoints of the first side followed by the (x, y)  coordinates of the other endpoint of the first side, followed by the  (x, y)  coordinates of one of the endpoints of the second side followed by the  (x, y)  coordinates of the other endpoint of the second side. All coordinates are in meters, to the nearest mm. All coordinates are between  -10000  and  +10000 . Input is terminated by end of file. Output For each line of input, print the  (x, y)  coordinates of the fourth point of the parallelogram in meters, to the...

UVA10642

Can You Solve It? Input:  standard input Output:  standard output Time Limit:  1 second First take a look at the following picture . In this picture, each circle has a coordinate according to Cartesian Coordinate System. You can move from one circle to another following the path denoted by forward arrow symbols. To go from a source circle to a destination circle, total number of step(s) needed = ( number of intermediate circles you pass + 1 ). For example, to go from ( 0 , 3 ) to ( 3 , 0 ) you have to pass two intermediate circles ( 1 , 2 ) and ( 2 , 1 ). So, in this case, total number of steps needed is 2 + 1 = 3. In this problem, you are to calculate number of step(s) needed for a given source circle and a destination circle. You can assume that, it is not possible to go back using the reverse direction of the arrows. Input The first line in the input is the number of test cases  n  (  0 < n <= 500  ) to handle. Following there a...

UVA10221

 Satellites The Problem The radius of earth is 6440 Kilometer. There are many Satellites and Asteroids moving around the earth. If two Satellites create an angle with the center of earth, can you find out the  distance  between them? By  distance  we mean both the  arc  and  chord  distances. Both satellites are on the same orbit. (However, please consider that they are revolving on a circular path rather than an elliptical path.) The Input The input file will contain one or more test cases. Each test case consists of one line containing two-integer  s  and  a  and a string " min " or " deg ". Here  s  is the distance of the satellite from the surface of the earth and  a  is the angle that the satellites make with the center of earth. It may be in minutes (  ‘  ) or in degrees ( 0  ). Remember that the same line will never contain minute and degree at a time. The ...

UVA10908

4 th   IIUC   Inter-University  Programming Contest, 2005 D Largest Square Input: standard input Output: standard output Problemsetter:  Tanveer Ahsan Given a rectangular grid of characters you have to find out the length of a side of the largest square such that all the characters of the square are same and the center [intersecting point of the two diagonals] of the square is at location  (r, c) . The height and width of the grid is  M  and  N  respectively. Upper left corner and lower right corner of the grid will be denoted by  (0, 0)  and  (M-1, N-1) respectively. Consider the grid of characters given below. Given the location (1, 2) the length of a side of the largest square is 3. abbbaaaaaa abbbaaaaaa abbbaaaaaa aaaaaaaaaa aaaaaaaaaa aaccaaaaaa aaccaaaaaa Input The input starts with a line containing a single integer  T (< 21) . This is followed by  T  test cases. The first line of...

UVA11417

Problem  A GCD Input:  Standard Input Output:  Standard Output Given the value of N, you will have to find the value of G. The definition of G is given below: Here  GCD( i,j ) means the greatest common divisor of integer  i  and integer j. For those who have trouble understanding summation notation, the meaning of G is given in the following code: G=0; for( i =1;i< N;i ++) for(j=i+1;j<= N;j ++) {     G+=GCD( i,j ); } /*Here GCD() is a function that finds the greatest common divisor of the two input numbers*/ Input The input file contains at most 100 lines of inputs. Each line contains an integer N (1<N<501). The meaning of N is given in the problem statement. Input is terminated by a line containing a single zero.  This zero should not be processed. Output For each line of input produce one line of output. This line contains the value of G for corresponding N. ...

UVA10922

Problem C - 2 the 9s Time Limit: 1 second Introduction to the problem A well-known trick to know if an integer N is a multiple of nine is to compute the sum S of its digits. If S is a multiple of nine, then so is N. This is a recursive test, and the depth of the recursion needed to obtain the answer on N is called the 9-degree of N. Your job is, given a positive number N, determine if it is a multiple of nine and,if it is, its 9-degree. Description of the input The input is a file such that each line contains a positive number. A line containing the number 0 is the end of the input. The given numbers can contain up to 1000 digits. Description of the output The output of the program shall indicate, for each input number, if it is a multiple of nine, and in case it is, the value of its nine-degree. See the sample output for an example of the expected formatting of the output. Sample input: 999999999999999999999 9 9999999999999999999999999999998 0 Sample output 999999999999999999999 is ...