BlueBook - Equation

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 16M

Problem type
BlueBook

Given the real coefficients a and b (-1\,000 \le a, b \le 1\,000), solve for x in the following equation.

\displaystyle ax + b = 0

Be sure to output indeterminate and undefined whenever appropriate. Remember \dfrac 0 0 is indeterminate, and something like \dfrac 4 0 is undefined.

Output the value of x rounded to two decimal places.

Input Specification

The input consists of two real numbers, a and b. a and b will be on separate lines, with a first, and b second.

Output Specification

Output the value of x according to the given values and equation. Be sure to output indeterminate and undefined whenever appropriate.

Sample Input 1

10
5

Sample Output 1

-0.50

Sample Input 2

13.5555
1.244685

Sample Output 2

-0.09

Sample Input 3

0
0

Sample Output 3

indeterminate

Sample Input 4

0
4

Sample Output 4

undefined

Comments


  • 1
    leenak  commented on Oct. 27, 2024, 3:48 p.m.

    I can't get through case 3


    • 0
      dchoo333  commented on Oct. 28, 2024, 12:30 a.m.

      Note that a and b can be negative, -4 / 0 is still undefined, and your code doesn't output anything if either a or b is negative.


  • 2
    689693  commented on Feb. 13, 2022, 3:34 p.m.

    I cannot get through case 1. the rest of them i passed.


    • 1
      Spitfire720  commented on Feb. 13, 2022, 5:21 p.m.

      You have to print 2 decimal places.