解题思路:
注意事项:
参考代码:
import java.util.Scanner;
class A
{
int x, y;
public A(int a)
{
x = a;
}
int aa()
{
if (x<1)
{
y = x;
}
else if (1<=x && x<10)
{
y = 2*x - 1;
}
else
{
y = 3*x - 11;
}
return y;
}
}
class B
{
public static void main(String[] args)
{
int x=0, y=0;
Scanner in=new Scanner(System.in);
x = in.nextInt();
A t = new A(x);
y = t.aa();
System.out.printf("%d", y);
}
}
0.0分
0 人评分