1292 - I2P (I) 2017_Yang_Lab2 Scoreboard

Time

2017/10/05 13:30:00 2017/10/05 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10741 The Encoded Word
11116 Palindrome
11561 Point distance

10741 - The Encoded Word   

Description

The input is a three-digit integer N that consists of digits 1-9 except 0. The task is to use the following rule to encode the input number:

First digit =>  even: 'A', odd: 'B'
Second digit => even: 'C', odd: 'D'
Third digit => even: 'E', odd: 'F'

For example, if the input is 489, the output should be  ACF because 4 is even, 8 is even, and 9 is odd.

Hints:
1. Given an integer x and two values M and N, we can use the following equation to select one of M and N according to x being even or odd.

           y = (x%2)*M + ((x+1)%2)*N;

That is, if x is odd, y will have value M; if x is even, y will get value N.

2. Characters like 'A', 'B', 'C' are constant values. We can use them in computations such as 0*'A' + 1*'B' or 'D' - 'A'.

Input

A three-digit integer consisting of only 1-9 but not 0

Output

The encoded three-letter word.
Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags

10401Contest



Discuss




11116 - Palindrome   

Description

The input will be a floating point number X which has 2 digits on the left of the point, and 3 digits on the right of the point. X consists of digits 1-9 except 0.
Interchange the two sides of the point to obtain another floating point number Y.
Finally, compute the sum of X and Y.

Example:
Input: 46.534
after interchanging: 534.46
after summing up:  580.994

Input

Given a floating point number X.

Output

The sum of X and Y.
The answer should be expressed as a floating point number with precision to the third decimal place. For example,
580.994.

Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11561 - Point distance   

Description

The purpose of programming is to solve complicated problems that humans are not able to solve quickly.

In the xy-coordinate system, there are a given line and a given point on the plane. The task is to print out the square of the shortest distance from the point to the line.

 

 

Input

Output

Please output the square of the distance from the point P to the line L with a new line. Note that the answer should be rounded to the second decimal place.

You can use printf(“%.2f\n", your_ans) to print out your answer. Remember that your_ans has to be in double type.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss