#137. 条件判断

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

条件判断

Conditional Check

Background

In daily programming, we often need to determine program behavior based on a series of conditions. This problem will test your understanding and application of conditional logic.

Problem Description

Given three integers aa, bb, cc, and a boolean value bOkbOk. Return true if bb is greater than aa and cc is greater than bb. However, with the exception that if bOkbOk is true, then bb does not need to be greater than aa.

Input Format

Input is given from standard input in the following format.

a b c bOk

Where aa, bb, cc are integers, and bOkbOk is a boolean value (represented as true or false).

Output Format

Output to standard output in the following format.

result

Where result is true or false.

Sample

1 2 4 false
true
1 2 1 false
false
1 1 2 true
true

Sample Explanation

Sample 1: a=1,b=2,c=4,bOk=extfalsea=1, b=2, c=4, bOk= ext{false}. Since bOkbOk is false, we need b>ab > a and c>bc > b. Here, 2>12 > 1 is true and 4>24 > 2 is true. Both conditions are met, so the result is true.

Sample 2: a=1,b=2,c=1,bOk=extfalsea=1, b=2, c=1, bOk= ext{false}. Since bOkbOk is false, we need b>ab > a and c>bc > b. Here, 2>12 > 1 is true, but 1>21 > 2 is false. Not all conditions are met, so the result is false.

Sample 3: a=1,b=1,c=2,bOk=exttruea=1, b=1, c=2, bOk= ext{true}. Since bOkbOk is true, we only need c>bc > b. Here, 2>12 > 1 is true. The condition is met, so the result is true.

Constraints

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