#212. 判断数字末位是否相同

    ID: 212 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatWarmup-1gesp1数学基础条件结构

判断数字末位是否相同

Same Last Digit

Background

Congcong is learning about number properties. He wants to know how to determine if two numbers have the same last digit.

Problem Description

Given two non-negative integer values, return true if they have the same last digit, such as with 2727 and 5757. Note that the % (mod) operator computes remainders, so 17(mod10)17 \pmod{10} is 77.

Input Format

Input is given from standard input in the following format.

a b

Output Format

Output is printed to standard output in the following format.

result

Sample

7 17
true
6 17
false
3 113
true

Sample Explanation

  • Sample 1: 7(mod10)=77 \pmod{10} = 7, and 17(mod10)=717 \pmod{10} = 7. Their last digits are both 77, so true is returned.
  • Sample 2: 6(mod10)=66 \pmod{10} = 6, and 17(mod10)=717 \pmod{10} = 7. Their last digits are different, so false is returned.
  • Sample 3: 3(mod10)=33 \pmod{10} = 3, and 113(mod10)=3113 \pmod{10} = 3. Their last digits are both 33, so true is returned.

Constraints

Time limit: 11 second per test case. Memory limit: 10241024 KiB per test case.