```#include<cstdio>
#include<cstring>
using namespace std;
char s;
int main()
{
int a,b;
while(scanf("%d%d",&a,&b)==2)
{
memset(s,0,sizeof(s));
a=a+b;
if(a==0)
{
printf("0\n");
continue;
}
int aa=a;
b=0;
if(a<0)
{
a=-a;
}
while(a)
{
int r=a%10;
s[b++]=('0'+r);
a=a/10;
}
if(aa<0)
{
printf("-");
}
for(int i=b-1; i>=0; i--)
{
if(i==0)
printf("%c\n",s[i]);
else
printf("%c",s[i]);
if(i%3==0&&i!=0)
printf(",");
}
}
return 0;
}
```

## PAT 1001. A+B Format（ Water problem ） More articles about

1. PAT 1001. A+B Format Problem solving

GitHub PDF 1001. A+B Format (20) Calculate a + b and output the sum in standard format -- that is, t ...

2. 2014 Baidu star qualification 1001:Energy Conversion（ Water problem , Logical questions ）

Energy Conversion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

3. pat 1001 A+B Format

Topic link : Portal A brief introduction to the topic : 1.  Given two integer values a,b: 2. Range -1000000 <= a, b <= 1000000: 3. Output the result in the specified format example :-100000 9 Output : -99 ...

4. PAT 1001 A+B Format (20 branch ) to_string()

subject Calculate a+b and output the sum in standard format -- that is, the digits must be separated into ...

5. URAL 1001 Reverse Root（ Water problem ？）

The problem is so easy, that the authors were lazy to write a statement for it! Input The input stre ...

6. PAT 1001 A+B Format (20 point(s))

subject : My first thought was : use math.h Medium log10 Function to calculate the number of digits ( This is not recommended , Because it's going to be slow , And there will be some other problems ): use pow Function splits according to where you want to insert a semicolon a+b In numbers ( for example res / p ...

7. PAT nail 1001. A+B Format (20) 2016-09-09 22:47 25 Human reading Comment on (0) Collection

1001. A+B Format (20) The time limit 400 ms Memory limit 65536 kB Code length limit 16000 B The procedure of judging questions Standard author CHEN, Yue Calculate ...

8. 1001 character string “ water ” topic （ Binary system ,map, Hash ）

1001: character string “ water ” topic The time limit : 1 Sec   Memory limit : 128 MB Submit : 210   solve : 39[ Submit ][ state ][ Discussion board ] Title Description Give a length of n String (1<=n<= ...

9. PAT (Advanced Level) Practice 1001 A+B Format (20 branch ) Ling Chen 1642

PAT (Advanced Level) Practice 1001 A+B Format (20 branch ) Ling Chen 1642 Title Description : Calculate a+b and output the sum i ...

## Random recommendation

1. ManagementClass Class parsing and C# How to get information about hardware

stay .NET In the project , Sometimes you need to get information about the hardware of the computer , stay C# Language needs to use ManagementClass This class is used for related operations . Now let's introduce ManagementClass class , First, let's look at class inheritance ...

2. Linux netstat Detailed command

Linux netstat Detailed command One   brief introduction Netstat The command is used to display various network related information , Such as network connection , Routing table , Interface status (Interface Statistics),masquerade Connect , many ...

3. new Dynamic allocation of array space

( One ) Define an integer               int *p =new int;        int *p =new int(4); // Assign initial value to 4 ( Two ) Define a one-dimensional array                 ...

4. problem -[VMware Workstation] After power failure , Restart the computer , And then I'll tell you “ internal error ”

Problem phenomenon : After a sudden blackout , Restart the computer , And on again VMware Workstation, It won't start . And then I'll tell you “ internal error ”. Question why : I hope you can give me some advice . Problem handling : close VMware Workstation, On the shortcut , ...

5. exit And return difference

1. exit Used to end a running program , It returns the parameter to OS, Give control to the operating system : and return Is to exit the current function , Return function value , Give control to the calling function .2. exit Is the system call level , It represents the end of a process ...

6. 1206: B. Sum up

Title Description Click here For positive integers n,k, We define such a function f, It satisfies the following rule Now give n and k, Your task is to calculate f(n,k) Value . Input First, an integer T, Express T Group data Next, the data for each group is n and k(1& ...

7. js and jquery Different ways to achieve seamless rotation of pictures

It's always good to master one more method , Learning programming requires more thinking , The lines Now write the code to realize the automatic play of pictures , Because learning is javascript, A lot of code , So I learned again jquery Operation of the library , It's very simple There are also very compelling ...

8. TOJ 1220 The number game / Deep search

The number game The time limit ( Ordinary /Java):1000MS/10000MS     Run memory limit :65536KByte describe There's a little game , Let you fill in the box below , requirement : a1+a2+a3+M=b1+b2+b3+M ...

9. UITableView Give Way cell The background color of the selected color disappears quickly , Instead of staying in cell On

// The cell is selected -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath ...

10. Mathematical programming solver lp_solve Detailed tutorial

Preface Recently, Xiao Bian studied the simplex method in operations research . therefore , Soon I can't help beating my heart . I had to pick up my pen and paper and think , A crucial issue : How to assemble a complete 13? Happen to happen , While I'm sitting in the library thinking , A beautiful little girl ...