# | Problem | Pass Rate (passed user / total user) |
---|---|---|
10716 | Arithmetic Sequence |
|
13964 | Stiff Waist Beast's Challenge |
|
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
Before entering NTHU CS, you need to pass the test given by Stiff Waist Beast, our Department President.
You have a four digit integer A, and you need to generate other three numbers B, C, D. The rules are as follows:
B = swap the first and second digit of A, and swap the third and fourth digit of A.
C = rotate A one digit to the right
D = reverse A
For example, if A = 1234
B = 2143, C = 4123, D = 4321
Input
a four digit integer A, it's guarantee that no 0 in A.
Output
Please output (A + B) / (C + D) to third decimal place.
Don't forget to print '\n' in the end!