解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int kg = scanner.nextInt();
char s = scanner.next().charAt(0);
int sum=0 ;
if (kg <= 1000) {
sum=8;
}else {
sum=8+(kg-1000)/500*4;
if ((kg-1000)%500!=0){
sum+=4;
}
}
if (s=='y'){
sum+=5;
}else {
sum+=0;
}
System.out.println(sum);
}
}
0.0分
1 人评分