結果

問題 No.500 階乗電卓
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-04-07 22:47:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 2,452 ms
コンパイル使用メモリ 71,888 KB
実行使用メモリ 57,604 KB
最終ジャッジ日時 2023-09-23 02:19:28
合計ジャッジ時間 5,819 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,620 KB
testcase_01 AC 118 ms
55,756 KB
testcase_02 AC 120 ms
55,488 KB
testcase_03 AC 120 ms
55,572 KB
testcase_04 AC 120 ms
55,936 KB
testcase_05 AC 120 ms
54,280 KB
testcase_06 AC 120 ms
57,604 KB
testcase_07 AC 121 ms
56,224 KB
testcase_08 AC 121 ms
55,956 KB
testcase_09 AC 120 ms
56,152 KB
testcase_10 AC 120 ms
56,076 KB
testcase_11 AC 120 ms
56,028 KB
testcase_12 AC 120 ms
56,232 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 119 ms
56,352 KB
testcase_16 AC 118 ms
55,244 KB
testcase_17 AC 119 ms
55,824 KB
testcase_18 AC 120 ms
55,352 KB
testcase_19 AC 120 ms
55,992 KB
testcase_20 AC 120 ms
55,664 KB
testcase_21 AC 121 ms
53,408 KB
testcase_22 AC 120 ms
55,172 KB
権限があれば一括ダウンロードができます

ソースコード

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