Java MyDouble Arithmetic Operations
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Implement a wrapper class MyDouble.
class MyDouble // Java {` private double a; // private variable MyDouble(double a) // Constructor public String toString() // Print the variable of type MyLong public MyDouble Add(MyDouble b) // Add the value of type MyDouble public MyDouble Add(long b) // Add the value of type double public MyDouble Sub(MyDouble b) // Subtract the value of type MyDouble public MyDouble Sub(long b) // Subtract the value of type double public MyDouble Mult(MyDouble b) // Multiply by the value of type MyDouble public MyDouble Mult(long b) // Multiply by the value of type double public MyDouble Div(MyDouble b) // Divide by the value of type MyDouble public MyDouble Div(long b) // Divide by the value of type double };
Input
Two double values of a and b.
Output
Print the value of expression (a * b + 10) / 3 + (a + 2 / b - 7) * 5 - a - b / a.
Examples
Input #1
Answer #1
Submissions 342
Acceptance rate 72%