#155. 最接近21且不超过21的值

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

最接近21且不超过21的值

Nearest to 21

Background

This is a simple number game where you need to determine which number is closer to a target value based on given rules.

Problem Description

Given two integer values greater than 00, return whichever value is nearest to 2121 without going over. Return 00 if they both go over.

Input Format

Input consists of two integers, separated by a space.

aa bb

Output Format

Output a single integer, representing the value nearest to 2121 without going over, or 00.

result

Sample

19 21
21
21 19
21
19 22
19

Sample Explanation

  • Sample 1: Given 1919 and 2121. 2121 is nearest to 2121 and does not go over.
  • Sample 2: Given 2121 and 1919. 2121 is nearest to 2121 and does not go over.
  • Sample 3: Given 1919 and 2222. 1919 does not go over 2121, while 2222 does. Thus, 1919 is returned.

Constraints

Time limit for each test case is 11 second, and memory limit is 10241024 KiB.