Hello everyone! Yes, it's me — hsc_boyfriend, the one who is loved by everyone!!
Today I want to teach you to solve a problem — A+B problem.
Let's take a look at the problem description: input two integers $$$a,b$$$, and output their sum $$$a+b$$$.
Sample Input:
1 1
Sample Output:
2
Maybe you laugh, this is a problem that even primary school students can solve!
At the first sight of the sample, it seems that I come back to primary school, I was ignorant and innocent... Ah, it's off the subject. In fact, it is to input two numbers and find the sum of the two numbers (the result of adding the two numbers). Now, you should be very confident, but before typing the code, we should pay attention to some small details!
When we type code, we should align the beginning of the line. It's better not to put sentences into one line, because the code will be very long in the future.
Pay attention to adding a semicolon at the end of each sentence. This is actually equivalent to a full stop in our C language. We should add a full stop reasonably when we say that we can't go on talking all at once.
Be sure to do the above two points, develop good programming habits from the beginning, will bring you benefits.
Let's take a look at the code I typed:
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<"\n";
return 0;
}
That's all for today's class. See you next time!
Look at this :-)
Are you sure this soln gives AC on https://codeforces.me/problemset/problem/409/H ?