#296. 根据条件判断两数正负

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

根据条件判断两数正负

Conditional Check

Background

Dawei is writing a program that needs to determine the positivity/negativity of two numbers based on certain conditions.

Problem Description

Given two integer values, return true if one is negative and one is positive. Except if the parameter negativenegative is true, then return true only if both are negative.

Input Format

Input is given from standard input in the following format.

a b negative

Output Format

Output is printed to standard output in the following format.

result

Sample

1 -1 false
true
-1 1 false
true
-4 -5 true
true

Sample Explanation

Sample 1: Input is a=1,b=1,negative=falsea=1, b=-1, negative=false. Since negativenegative is false, and aa is positive while bb is negative, the condition "one is negative and one is positive" is met, so true is returned.

Sample 2: Input is a=1,b=1,negative=falsea=-1, b=1, negative=false. Since negativenegative is false, and aa is negative while bb is positive, the condition "one is negative and one is positive" is met, so true is returned.

Sample 3: Input is a=4,b=5,negative=truea=-4, b=-5, negative=true. Since negativenegative is true, and both aa and bb are negative, the condition "both are negative" is met, so true is returned.

Constraints

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