Tính tổng S = ~\frac{1}{2}~ + ~\frac{2}{3}~ + … + ~\frac{n}{n+1}~

View as PDF

Submit solution

Points: 100.00
Time limit: 1.0s
Memory limit: 100M
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, GAS64, Pascal, Perl, PHP, Python, Sed, TCL, Text

Tính ~S(n)~ = ~\frac{1}{2}~ + ~\frac{2}{3}~ + ~\frac{3}{4}~ + … + ~\frac{n}{n+1}~. Với ~n~ cho trước.

  • Đầu vào là 1 số 𝑛
  • Đầu ra là kết quả 𝑆

Lưu ý: Giá trị ~S~ chỉ làm tròn còn 2 số thập phân

Input

3

Output

1.92

Input

10

Output

7.98

Comments

Please read the guidelines before commenting.


There are no comments at the moment.