[Java] c002. f91

非常明顯 這是數學問題
import java.util.Scanner;
 
public class C002 {
 
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in); 
        while (in.hasNext()) {
            String input = in.nextLine();
            int n = Integer.parseInt(input);
            while(n != 0){
                if(n > 100){
                    int j = n - 10;
                    System.out.println("f91("+ n +") = "+ j);
                    break;
                }
                else{
                    System.out.println("f91("+ n +") = 91");
                    break;
                }
            }
        }
         
    }
}

沒有留言:

張貼留言