PATOneByOne 1001

Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). git

Input app

Each input file contains one test case. Each case contains a pair of integers a and b where -1000000 <= a, b <= 1000000. The numbers are separated by a space. less

Output ide

For each test case, you should output the sum of a and b in one line. The sum must be written in the standard format. spa


Sample Input code

-1000000 9
Sample Output
-999,991


Trick: orm

*The output starts from left to right.  three

*Divide it into two cases, one is the negative case the other positive. input

*Count the digits LEFT to be printed; If %3==0 append a comma, else do nothing. it

Nov. 1, 2013

相關文章
相關標籤/搜索