Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
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? |
|
2018-11-01 01:11:36 Krystian Plackowski
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 |
|
2017-02-14 20:14:57 Francky
judge => http://www.spoj.com/files/judge/12890/ I think this is visible only by psetter. You can add a comment at the end of this thread, like some did. thread => http://discuss.spoj.com/t/how-to-add-problem-into-spoj/693/32 Some infos here : http://www.spoj.com/tutorials/PSINT/ That, and the sample judges should be enough. Tell me. You can have a look too at other built'in judges. Last edit: 2017-02-15 06:49:19 |