題目:Sagit's 計分程式
import java.util.Scanner;
public class Sagits{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int number = sc.nextInt();
System.out.println(
(number > 40) ? 100 :
(number > 20) ? 100 - (40 - number) :
(number > 10) ? 80 - (20 - number) * 2 :
number * 6
);
}
}
}
沒有留言:
張貼留言