Limits 1s, 512 MB

Given any circle, if you divide the circumference of that circle with its diameter, you would always find the same constant value of pi. This constant is so famous that we even have a day dedicated, just to this constant! So in this problem, we would like to tease you with the fascinating properties of pi. Let’s see if you can code and give us the first few digits of pi after the decimal places.

To help you with the job, we are providing you a C code that would print up to the first 12 digits of pi after the decimal places. But hey, you should not trust everything that you see on the internet.

1#include <stdio.h>
2#include <math.h>
3
4int main() {
5    double val = 2 * acos(0.0);
6    printf("%.12lf\n",val);
7    return 0; 
8}

Input

The first line contains an integer TT (1T1001 ≤ T ≤ 100), the number of testcases. Each of the following T lines will have a single integer NN (1N121 ≤ N ≤ 12), the position of the decimal digit you need to print.

Output

For each testcase, print a number on a line by itself, the digit of pi in a given position.

Sample

InputOutput
3
1
2
3
1
4
1

Submit

Login to submit.

Contributors

Statistics

96% Solution Ratio
protapEarliest, Mar '17
AnikcsejnuFastest, 0.0s
SIR.24Lightest, 0 B
Nusab19Shortest, 46B
Toph uses cookies. By continuing you agree to our Cookie Policy.