class Demo
{
public static void main(String[] args)
{
//y <= (2*x+2)/3 不等式的值
System.out.println(printBoolean(3,4));
//y = (2*x+2)/3 y的最小整数
System.out.println(printFloor(3));
//y = (2*x+2)/3 y的最大整数
System.out.println(printCeil(3));
// y = (2*x+2)/3 默认情况下y的值
System.out.println(printDefault(3));
}
public static double printFloor(double x)
{
return Math.floor((2*x+2)/3);
}
public static double printCeil(double x)
{
return Math.ceil((2*x+2)/3);
}
public static boolean printBoolean(int x,int y)
{
return y<=(2*x+2)/3;
}
public static int printDefault(int x)
{
return (2*x+2)/3;
}
}
|