Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
求π
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 28, Accepted users: 24
Problem 11604 : No special judgement
Problem description
  很多公式可以用来计算π,甚至还可以用概率的方法!我们这里提供一个最简单的公式:
π/4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 - …
请利用该公式将π计算到指定位数。

Input
  输入有若干行,每行一个非负整数n,表示输出π的小数位数,n小于等于12。n等于-1时,测试结束。

Output
  对每个输入(-1除外),输出对应小数位数的π,四舍五入。

Sample Input
2
3
-1
Sample Output
3.14
3.142
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2027 today,16258754 total, since 2010-05-07