P1727 Compute π
Background
Chapter 1 of "The Story of Ai Yu Chou, Part II · compute".
Description
As the Mid-Autumn Festival arrives, the clattering sounds of bo bing (博饼) are unceasing. Aiyuchou, excited to play bo bing at school, ends up bringing home only "Yi Xiu" and "Er Ju". Furious, Aiyuchou calls Yueluo Wuti: "Hey, help me compute the digits of pi after the decimal point up to $n(n \le 10000)$ places, quickly..." and hangs up, not knowing Yueluo Wuti was about to go to class. Yueluo Wuti then turns to you, asking you to write a program to compute the digits of pi after the decimal point up to $n$ places.
Input Format
One line containing an integer $n$.
Output Format
The output contains multiple lines.
On the first line, print the string $\verb!3.!$.
Starting from the second line, output the fractional part of pi. Insert a space after every $10$ digits, and insert a newline after every $50$ digits.
Explanation/Hint
For $30\%$ of the testdata, $n\leq 10^3$.
For $100\%$ of the testdata, $n\leq 10^4$.
Time limit: test points $1\sim 6$: $1$ second; test point $7$: $3$ seconds; test point $8$: $8$ seconds; test points $9\sim 10$: $12$ seconds.
Translated by ChatGPT 5