-
Title Description:
-
Given two integers a and b, the representation is: start with a single digit and each three digits separated by a comma ",".
Now calculate the results of the a+b and output in the normal form.
-
Input:
The
-
input contains multiple sets of data, one row for each group of data, consisting of two integers a and B ( -10^9 < b < 10^9).
-
Output:
-
Please calculate the results of the a+b and output in normal form, one row per group of data.
-
Sample input:
-
-234,567,890 123,456,7891,234 2,345,678
-
Sample output:
-
-1111111012346912
Can be thought of as a string processing
1 ImportJava.util.Scanner;2 3 Public classmain{4 Public Static voidMain (string[] args) {5Scanner in=NewScanner (system.in);6 while(In.hasnext ()) {7String line=in.nextline ();8String[] Num=line.split ("");9 intAns=0;Ten for(inti=0;i<2;i++){ OneString[] T=num[i].split (","); AString ans_str= ""; - intLen=t.length;//calculated separately so that it does not have to be calculated once for each time in the for loop - for(intj=0;j<len;j++){ theans_str+=T[j]; - } -ans+=Integer.parseint (ANS_STR); - } + System.out.println (ans); - } + } A } at /************************************************************** - problem:1003 - user:0000h - Language:java - result:accepted - time:80 Ms in memory:15488 KB - ****************************************************************/
Topic 1003:a+b