BINARYIO - Binary Input and Output
Your task is to compute natural logarithm for real parameter X with absolute or relative error less than 10-12.
Input
Array of doubles in binary format (use fread in C/C++)
10-12 ≤ X ≤ 1012. There will be up to 1,000,000 numbers in array.
Output
Array of doubles in binary format (use fwrite in C/C++)
For each number in input you should output the corresponding answer.
Example
Input: 1 10 Output: 0 2.3025850929940456840179914546844
Note: Sample input and output are readable for your convenience!!!
Arrays in memory and in input are byte-to-byte identical.
To read double a use fread(&a, sizeof(a), 1, stdin) instead of scanf("%lf", &a) until the end of file.
To write double a use fwrite(&a, sizeof(a), 1, stdout) instead of printf("%lf\n", a).
hide comments
moudud:
2023-09-08 08:07:11
What is meant by array of doubles in binary format? What should I output for negative values? |
|
Francky:
2013-03-01 18:44:04
I tried both methods to read (whole input, or double by double)... It works at home... Any clue for WA here ? Thanks.
|
|
Mitch Schwartz:
2013-03-01 18:36:26
Ohhh, no bit strings at all, now I understand. |
|
Mitch Schwartz:
2013-03-01 18:36:26
I haven't done extensive bugtesting, but the question is a little unclear because it does not specify bit order; I'm using Wikipedia convention:
|
Added by: | Michael Kharitonov |
Date: | 2013-03-01 |
Time limit: | 0.100s-1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |