結果

問題 No.500 階乗電卓
ユーザー kohaku_kohaku
提出日時 2017-04-07 22:47:23
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 1,833 ms
コンパイル使用メモリ 74,940 KB
実行使用メモリ 54,404 KB
最終ジャッジ日時 2024-07-16 02:44:08
合計ジャッジ時間 5,381 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        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