| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12369 | New Operator |
|
| 12375 | grometeic series |
|
Description
One day, a mathematician defined a new operator ⊙ and used it on his work. However, the mathematician didn't know how to write a program to make a computer calcuate the result. He decided to hire you to write a program for him. The following shows how the new operator ⊙ is defined.
new operator ⊙ : give two integer A,B (A is a three digit integer, B is a two digit integer).
A ⊙ B = (sum of all digits in A) / (sum of all digits in B)
ex: 123 ⊙ 23 = (1+2+3) / (2+3) = 1.20note that : if use visual studio add #pragma warning(disable:4996) in first line to use scanf function
Input
Given two integer A, B (A is three-digit integer, B is two-digit integer)
Output
Print out the result of A ⊙ B (Note that your output should follow three rules)
rule1. the length of the output string is exactly 13 character.
rule2. the result value should be expressed as a floating point number round off to the 2nd decimal place. For example, 3.00 or 6.53
rule3. print '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In mathematics, a geometric progression, also known as a geometric sequence, is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio. For example, the sequence 2, 6, 18, 54, ... is a geometric progression with common ratio 3.
Here, you are given an geometric sequence, where the initial term is ‘a’, the total number of terms in this sequence is ‘n’, and the common ratio is ‘r’. Then, in this sequence: what is the value of the nth term, and what is the sum of all the terms?

note that : if use visual studio add #pragma warning(disable:4996) in first line to use scanf function
Input
Three integers separated by blanks. The first integer (a) is the initial term, where 0<a<10. The second integer (n) is the total number of terms in the sequence, where n>0 and n<10. The third integer (r) is the common ratio, where 0<r<4.
a,n,r should be type double and use %lf.
you should import lib math.h and use pow(r,n) to calculate r^n.
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 need to print '\n' at the end of the output.