/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner scanIn
= new Scanner
(System.
in); double x, e;
x = scanIn.nextDouble();
e = scanIn.nextDouble();
double sum1 = x; // в случае, когда i=0
double sum2 = -x * x * x / 6; // в случае, когда i=1
for (int i
= 2; Math.
abs(1 / sum2
- 1 / sum1
) >= e
; i
++) { sum1 = sum2;
sum2 *= -x * x / ((2 * i) * (2 * i + 1));
}
System.
out.
println("1 / sum2: " + 1 / sum2
); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgc2NhbkluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlkb3VibGUgeCwgZTsgCgoJCXggPSBzY2FuSW4ubmV4dERvdWJsZSgpOyAKCQllID0gc2NhbkluLm5leHREb3VibGUoKTsKCgkJZG91YmxlIHN1bTEgPSB4OyAvLyDQsiDRgdC70YPRh9Cw0LUsINC60L7Qs9C00LAgIGk9MAoJCWRvdWJsZSBzdW0yID0gLXggKiB4ICogeCAvIDY7IC8vINCyINGB0LvRg9GH0LDQtSwg0LrQvtCz0LTQsCBpPTEKCgkJZm9yIChpbnQgaSA9IDI7IE1hdGguYWJzKDEgLyBzdW0yIC0gMSAvIHN1bTEpID49IGU7IGkrKykgewoJCQlzdW0xID0gc3VtMjsKCQkJc3VtMiAqPSAteCAqIHggLyAoKDIgKiBpKSAqICgyICogaSArIDEpKTsgCgkJfQoKCQlTeXN0ZW0ub3V0LnByaW50bG4oIjEgLyBzdW0yOiAiICsgMSAvIHN1bTIpOwoJfQp9