Daming A+b
Time limit:3000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 9273 Accepted Submission (s): 3318
problem DescriptionSay, after a long one months, Xiaoming has grown a lot, so he changed a name called "Daming".
At this time he is not the only one who will do the addition of the "Xiao Ming", and now he will even arbitrary length of the addition of the positive decimal.
Now, give you two positive decimals A and B, your task is to calculate the value of A+b on behalf of Daming.
InputThis topic contains multiple sets of test data, please process to the end of the file.
Each set of test data contains two positive decimals A and B with a length of not more than 400 in a row.
OutputPlease output the output a+b value in one line, please output the simplest form. Please see sample Output for detailed requirements.
Sample Input1.1 2.91.1111111111 2.34443233431 1.1
Sample Output43.45554344542.1 SolvingGod C++,java Dafa Good people doing, days in the look, not believe Baidu Nine C + +
Import java.util.*; Import java.io.*; Import Java.math.*; Public classmain{ Public Static voidMain (string[] args) {Scannerinch=NewScanner (System.inch); while(inch. Hasnext ()) {BigDecimal a=inch. Nextbigdecimal (); BigDecimal b=inch. Nextbigdecimal (); System. out. println (A.add (b). Striptrailingzeros (). toplainstring ()); //stripxxxx Remove the rear 0//Toplainstring is the return of the ordinary counting method } } }
Hdoj 1753 daming a+b High precision/java