給出3個整數,
a
b
c
,和布爾equalOK
打印"Strictly Increasing Order"
如果a
b
c
是嚴格遞增的順序,如2 5 11
,或5 6 7
,但不6 5 7
或5 5 7
。但是,如果"equalOk"
爲true
,則允許相等,例如5 5 7
或5 5 5
print"Increasing Order"
。否則打印"Not in order"
。秩序的三個整數
這是我到目前爲止有:
import java.util.*;
public class Problem8
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();
boolean equalOK = true;
equalOK = scan.nextBoolean();
if(c > b && c > a && b > a)
{
System.out.println("Strictly Increasing Order");
}
else if((a == b && c > b && equalOK) || (b == c && c > a && equalOK) || (a == b && b == c && equalOK))
{
System.out.println("Increasing Order");
}
else
{
System.out.println("Not in Order");
}
}
}
當我提出這一個網上法官它給了我一個分數的21/100
有什麼問題嗎?
是什麼'嚴格遞增Order'和'增加Order'之間的區別? –
我想這意味着嚴格遞增順序是三個整數彼此不同時,而遞增順序是至少兩個相同。 – Kj45
嚴格意義上,數字不能相等。 – annoirq