結果

問題 No.500 階乗電卓
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-04-07 22:40:20
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 463 bytes
コンパイル時間 3,250 ms
コンパイル使用メモリ 72,288 KB
実行使用メモリ 57,724 KB
最終ジャッジ日時 2023-09-23 01:51:29
合計ジャッジ時間 6,346 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 124 ms
55,960 KB
testcase_05 AC 126 ms
55,844 KB
testcase_06 AC 124 ms
55,924 KB
testcase_07 AC 125 ms
55,800 KB
testcase_08 AC 128 ms
55,688 KB
testcase_09 AC 125 ms
55,772 KB
testcase_10 AC 124 ms
55,984 KB
testcase_11 AC 125 ms
55,844 KB
testcase_12 AC 125 ms
55,984 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 126 ms
55,780 KB
testcase_16 AC 126 ms
55,288 KB
testcase_17 AC 126 ms
55,376 KB
testcase_18 AC 124 ms
55,724 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

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