結果

問題 No.500 階乗電卓
ユーザー kohaku_kohaku
提出日時 2017-04-07 22:40:20
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 463 bytes
コンパイル時間 2,528 ms
コンパイル使用メモリ 78,328 KB
実行使用メモリ 54,432 KB
最終ジャッジ日時 2024-07-16 02:20:55
合計ジャッジ時間 7,044 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 2 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long Z = 1;
        long mod = (long)Math.pow(10,12);
        for(int i=1; i<=N; i++){
            Z*=i;
            Z%=mod;
            if(Z==0){
                System.out.println("000000000000");
                System.exit(0);
            }
        }
        System.out.println(Z);
    }
}
0