| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10716 | Arithmetic Sequence |
|
| 10728 | A simple set problem |
|
| 11549 | Easy Palindrome |
|
Description
An arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is a constant. For instance, the sequence 5, 7, 9, 11, 13, 15 … is an arithmetic sequence with common difference of 2.
Here, you are given an arithmetic sequence, where the initial term is ‘a’, the total number of terms in this sequence is ‘n’, and the common difference of successive terms is ‘d’. Then, in this sequence: what is the value of the nth term, and what is the sum of all the terms?
Input
Three integers separated by blanks. The first integer (a) is the initial term, where -1000<a<1000. The second integer (n) is the total number of terms in the sequence, where n>0 and n<1000. The third integer (d) is the common difference, where -1000<d<1000.
Output
Two values separated by a blank. The first value is the nth term of the sequence, and the second value is the sum of the sequence. Note that you do not need to print '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Out of the N NTHU 2015 Computer Science (CS) majors, X of them take the course CS13550* Introduction to Programming (I), Y of them take the course CL10100* College Chinese, and Z of them take none of the two courses (i.e., CS13550* and CL10100*). How many NTHU 2015 CS majors take both of the two courses? And how many take CS13550* but not CL10100*?
Input
Four integers N, X, Y, Z which are separated by blanks. Note that 0<N<1000, 0<X<1000, 0<Y<1000 and 0<Z<1000.
Output
Two integers separated by a blank. The first integer is the number of NTHU 2015 CS majors who take both CS13550* and CL10100*, and the second one is the number of NTHU 2015 CS majors who take CS13550* but not CL10100*. Note that you do not need to print '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input is a 6-digit floating number N that consists of digits 1-9 except 0. For example, 156.854 is such a number. The task is to reverse the order of the digits of integer part and decimal part respectively to get a new six-digit floating number M, and compute the sum of the N and M. For example, if N is 123.456, then M is 321.654, and the answer should be 445.110.
Hint1: you can use double type to store input
Hint2: if your answer is 445.110000, you can use %.3lf to print 445.110
Input
A six-digit floating number consisting of 1-9 except 0
Output
The sum of the input number and its reversal
The answer should be expressed as a floating point number with precision to the three decimal place. For example, 445.110
Note that you do not need to print ‘\n’ at the end of the output.