Java Fraction 2
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Find the sum of numerator and denominator of a given fraction.
Implement a class Fraction that uses a wrapper class MyLong.
class MyLong // Java { private long a; // one private variable MyLong(long a) // Constructor public String toString() // Print a variable of type MyLong public long GetValue() // Return the value of the private variable }; class Fraction { MyLong numerator, denominator; // numerator and denominator Fraction(String s) // Constructor public MyLong GetNumerator() // Return numerator of type MyLong public MyLong GetDenominator() // Return denominator of type MyLong public MyLong Sum() // Return sum of numerator and denominator in the variable of type MyLong };
Input
String in the form a/b (-10^18
≤ a, b ≤ 10^18
).
Output
Print the sum of a and b.
Examples
Input #1
Answer #1
Submissions 354
Acceptance rate 46%