题目链接:B - Hard Calculation (atcoder.jp)

Problem Statement

You are given positive integers A and B.
Let us calculate A+B (in decimal). If it does not involve a carry, print Easy; if it does, print Hard.

Constraints

  • A and B are integers.
  • 1≤A,B≤1018

Input

Input is given from Standard Input in the following format:

A B

Output

If the calculation does not involve a carry, print Easy; if it does, print Hard.


Sample Input 1

229 390

Sample Output 1

Hard

When calculating 229+390, we have a carry from the tens digit to the hundreds digit, so the answer is Hard.


Sample Input 2

123456789 9876543210

Sample Output 2

Easy

We do not have a carry here; the answer is Easy.
Note that the input may not fit into a 32-bit integer.

题意:问a+b的过程中是否产生进位,如果有输出hard,否则easy

思路:每一位都提取出来来进行运算。直到a为0或者b为0

#include<bits/stdc++.h>
using namespace std;int main(){long long a, b;cin >> a >> b;bool flag = 0;while(a && b && !flag){int ans = a % 10;int cnt = b % 10;if(ans + cnt >= 10){flag = 1;break;}a /= 10;b /= 10;}if(flag){cout << "Hard" << endl;}else{cout << "Easy" << endl;}return 0;
}

NEC Programming Contest 2021(AtCoder Beginner Contest 229) B - Hard Calculation相关推荐

  1. Caddi Programming Contest 2021(AtCoder Beginner Contest 193) 题解

    Caddi Programming Contest 2021(AtCoder Beginner Contest 193) A - Discount 打折浮点数除即可 B - Play Snuke 枚举 ...

  2. NEC Programming Contest 2021 (AtCoder Beginner Contest 229)

    终于开始补提了 重点 : C, E的倒着算, F的染色,G的相邻的转换: B - Hard Calculation #include <iostream> #include <alg ...

  3. Atcoder TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) B - Takahashi‘s Secret

    题目链接:B - Takahashi's Secret (atcoder.jp) Problem Statement Takahashi has N friends. They have nickna ...

  4. Atcoder TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) C - Final Day

    题目链接:C - Final Day (atcoder.jp) Problem Statement N students are taking a 4-day exam. There is a 300 ...

  5. KYOCERA Programming Contest 2021 (AtCoder Beginner Contest 200) A~E 题解

    ABC200/KYOCERA2021 A~E [A - Century](https://atcoder.jp/contests/abc200/tasks/abc200_a) 题目大意 输入格式 输出 ...

  6. Mynavi Programming Contest 2021 (AtCoder Beginner Contest 201) A~E 题解

    ABC201/Mynavi2021 A~E [A - Tiny Arithmetic Sequence](https://atcoder.jp/contests/abc201/tasks/abc201 ...

  7. TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) ABCD

    A 题意: 有一个开关,每天s点开,t点关(可能在第2天或第n天),判断x点时开着还是关着. 思路: 按照是否需要隔夜分个类. #include<bits/stdc++.h> using ...

  8. Caddi Programming Contest 2021(AtCoder Beginner Contest 193) F.Zebraness

    题目链接 Problem Statement We have a grid with N horizontal rows and N vertical columns. Let (i,j) denot ...

  9. NOMURA Programming Contest 2021(AtCoder Regular Contest 121)

    文章目录 A - 2nd Greatest Distance B - RGB Matching C - Odd Even Sort D - 1 or 2 E - Directed Tree F - L ...

最新文章

  1. pythonweb服务器部署iis_Python开发入门与实战15-IIS部署
  2. 一文搞懂select语句在MySQL中的执行流程!
  3. linux终端的背景_如何在终端显示图像缩略图 | Linux 中国
  4. void类型及void指针
  5. 跨业自学党的第一次面试
  6. matlab矩阵中的 *、/、\、.*
  7. bitnami_redmine3.3.0-1 问题及备份恢复
  8. 主键重复和唯一索引冲突_深入了解数据库索引
  9. HTML5期末大作业:家乡网站设计——石家庄(10页) HTML+CSS+JavaScrip 旅游网页html 家乡介绍html网页设计 dw旅游景点网页设计 web课程设计网页规划与设计
  10. gitlab自定义头像设置
  11. Linux下ALSA驱动分析
  12. excel 两列数据合并去重取并集
  13. —— GPS测量原理及应用复习-6 ——
  14. Qt程序运行时出现:0xc000007b错误参考解决方法
  15. git如何拉去开发的 最新代码_git拉取代码到本地
  16. LM317的直流可调稳压电源Multisim仿真设计(附仿真+论文+参考资料)
  17. MTK6735/37 插入USB开机
  18. java都市男人心痒痒_男人最想听的情话不是我爱你那是什么 说的男人心痒痒的情话大全...
  19. 人工智能基础之美女和野人过河问题
  20. python处理表格数据教程_利用Python处理Excel数据

热门文章

  1. SPU ITEM SKU
  2. 系统设定工具(网络、打印机)与硬件侦测
  3. 《人工智能及其应用》课程笔记(四)第4章 非经典推理
  4. jQuery append( ) 方法
  5. 【element-plus】el-dialog距离顶部的高度
  6. 单、双精度浮点型转换为十六进制方法
  7. 如何将月度数据转换成日度数据
  8. C++ Primer Plus 编程练习3
  9. 全局vue中修改字体样式 苹方字体 微软雅黑 亲测可用
  10. 如何做一个靠谱的产品经理