結果

問題 No.500 階乗電卓
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-04-07 22:38:09
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 370 bytes
コンパイル時間 1,908 ms
コンパイル使用メモリ 74,084 KB
実行使用メモリ 54,468 KB
最終ジャッジ日時 2024-07-16 01:21:50
合計ジャッジ時間 5,504 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 5 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)break;
        }
        System.out.println(Z);
    }
}
0