#132. 派对评估

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

派对评估

Party Evaluation

Background

Dawei and Xiaoxiao are organizing a party for their friends. The success of the party depends on the amounts of tea and candy.

Problem Description

We are having a party with certain amounts of tea and candy. Return an integer outcome of the party, encoded as 0=bad, 1=good, or 2=great.

A party is good (1) if both tea and candy amounts are at least 5.

However, if either the tea amount or the candy amount is at least double the amount of the other one, the party is great (2).

In all cases, if either the tea amount or the candy amount is less than 5, the party is always bad (0).

Input Format

Input is given from standard input in the following format.

tea candy

Output Format

Output is printed to standard output in the following format.

An integer representing the party outcome (0, 1, or 2).

Sample

6 8
1
3 8
0
20 6
2

Sample Explanation

Sample 1: Tea amount is 6, candy amount is 8. Both are at least 5. The tea amount (6) is not double the candy amount (8), and the candy amount (8) is not double the tea amount (6). Thus, the party is good (1).

Sample 2: Tea amount is 3, candy amount is 8. The tea amount is less than 5. Thus, the party is bad (0).

Sample 3: Tea amount is 20, candy amount is 6. Both are at least 5. The tea amount (20) is at least double the candy amount (6) (202×6=1220 \ge 2 \times 6 = 12). Thus, the party is great (2).

Constraints

Time limit: 1 second, Memory limit: 1024 KiB for each test case.