P21858 [GeeksforGeeks] Nth digit of pie5851
提高-
题目描述

Calculate the Nth digit in the representation of Pi.

Example 1:
Input:
N = 1
Output:
3
Explanation:
Value of Pi is 3.14...
So, the first digit is 3.
Example 2:
Input:
N = 2
Output:
1
Explanation:
Value of Pi is 3.14...
So, the second digit is 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function nthDigOfPi() which takes an Integer N as input and returns the N^{th} digit of Pi.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N <= 10^{4}

输入格式

见题面

输出格式

见题面

样例输入
N = 1
样例输出
3