当先锋百科网

首页 1 2 3 4 5 6 7
import java.math.BigInteger;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()){
            int num = scan.nextInt();
            BigInteger bg2 = BigInteger.ONE;
            BigInteger bg1 = BigInteger.ZERO;
            BigInteger bg3 = BigInteger.ZERO;
            for(int i = 1; i <= num; i++){
                bg3 = bg1.add(bg2);
                bg1 = bg2;
                bg2 = bg3;
            }
            System.out.println(bg3);
        }
    }
}

import java.math.BigInteger;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNextInt()){
            int num = scan.nextInt();
            BigInteger bg = BigInteger.ONE;
            for(int i = 1; i <= num; i++){
                bg = bg.multiply(BigInteger.valueOf(i));
            }
            System.out.println(bg);
        }
    }
}