问题 A: Programming Education
题目描述
In 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.
One day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A,B and prints A+B.
Takahashi, who is taking this exam, suddenly forgets his age.
He decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A,B and prints A+B if N=2.
Write this program for him.
Constraints
·N is 1 or 2.
·A is an integer between 1 and 9 (inclusive).
·B is an integer between 1 and 9 (inclusive).
输入
Input is given from Standard Input in one of the following formats:
1
或者
2
A
B
输出
If N=1, print Hello World; if N=2, print A+B.
样例输入
1
样例输出
Hello World
解题思路:
水题
如果是输入的为1,输出Hello World,如果输入的为2,输出a+b
AC代码:
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n==1)
cout<<"Hello World";
if(n==2)
{
int a,b;
cin>>a>>b;
cout<<a+b;
}
return 0;
}