AtCoder Beginner Contest 112解题报告

A - Programming Education

Time limit : 2sec / Memory limit : 1024MB

Score: 100 points

【Problem Statement】

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】

Input is given from Standard Input in one of the following formats:
1
2
A
B

【Output】

If N=1, print Hello World; if N=2, print A+B.

【Sample Input 1】

1

【Sample Output 1】

Hello World

As N=1, Takahashi is one year old. Thus, we should print Hello World.

【Sample Input 2】

2
3
5

【Sample Output 2】

8

As N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.

【题解】

按照题意模拟即可,数据范围极小,期望得分100分。

https://abc112.contest.atcoder.jp/tasks/abc112_a

【AC代码】

/*
    Coded by Apojacsleam
*/
#include<cstdio>
int main()
{
    int n;
    scanf("%d",&n);
    if(n==1) puts("Hello World");
    else
    {
        int a,b;
        sc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值