BERNULLI - Bernoulli numbers
Your task is to compute natural logarithm of the absolute value of the Bernoulli number for many integer parameters N.
I/O format is the same as in BINARYIO.
Input
Array of unsigned 32 bit integers in binary format (use fread in C/C++)
To read unsigned N use fread(&N, sizeof(N), 1, stdin) instead of usual scanf("%u", &N) until the end of file.
For each test case 2 ≤ N < 232, N is even. There will be up to 1,250,000 numbers in input file.
Output
Array of doubles in binary format (use fwrite in C/C++)
To write double a use fwrite(&a, sizeof(a), 1, stdout) instead of usual printf("%lf\n", a).
For each N output ln(|BN|) with absolute or relative error less than 10-15
Example
Input:
4
10
50
Output:
-3,4011973816621553754132366916069
-2,580216829592325170273661603119
57,277060811865704087099873424857
Sample input and output are readable for your convenience!!!
TL = 5 * My time
hide comments
taranov_srg:
2020-12-15 22:34:57
@mikhaelkh is the idea of using the Bernouli_N approximation by 2*N!/(2*Pi)^N starting any N correct? |
|
Krystian Plackowski:
2018-11-01 01:11:36
I will leave a hint for followers: Bernoulli numbers, that are less than 1 produce the biggest error... and there are not too many of them. Last edit: 2018-11-01 19:57:39 |
|
Francky:
2017-02-14 20:14:57
judge => http://www.spoj.com/files/judge/12890/
|
Added by: | Michael Kharitonov |
Date: | 2017-02-14 |
Time limit: | 0.200s |
Source limit: | 10000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C-CLANG C C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 |