#138. 条件判断三数递增性

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

条件判断三数递增性

Check Increasing Sequence

Background

This is a small problem about determining the order of a sequence of numbers.

Problem Description

Given three integers a,b,ca, b, c and a boolean equalOk, return true if they are in strict increasing order, such as 2,5,112, 5, 11, or 5,6,75, 6, 7, but not 6,5,76, 5, 7 or 5,5,75, 5, 7.

However, if equalOk is true, equality is allowed, such as 5,5,75, 5, 7 or 5,5,55, 5, 5 should also return true.

Input Format

Input is given from Standard Input in the following format.

a b c equalOk

Where a,b,ca, b, c are integers, and equalOk is a boolean value (true or false).

Output Format

Output is printed to Standard Output in the following format.

true or false

Sample

2 5 11 false
true
5 7 6 false
false
5 5 7 true
true

Sample Explanation

Sample 1: 2<5<112 < 5 < 11, and equalOk is false, which satisfies strict increasing order, so true is returned.

Sample 2: 5<75 < 7 but 7ot<67 ot< 6, which does not satisfy strict increasing order, so false is returned.

Sample 3: 5575 \le 5 \le 7, and equalOk is true, which satisfies non-decreasing order, so true is returned.

Constraints

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