結果

問題 No.500 階乗電卓
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-04-07 22:51:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 71,736 KB
実行使用メモリ 56,476 KB
最終ジャッジ日時 2023-09-23 02:22:52
合計ジャッジ時間 5,738 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,880 KB
testcase_01 AC 120 ms
55,484 KB
testcase_02 AC 120 ms
55,660 KB
testcase_03 AC 120 ms
55,836 KB
testcase_04 AC 120 ms
56,072 KB
testcase_05 AC 121 ms
56,476 KB
testcase_06 AC 122 ms
56,296 KB
testcase_07 AC 120 ms
55,804 KB
testcase_08 AC 121 ms
56,156 KB
testcase_09 AC 120 ms
55,800 KB
testcase_10 AC 120 ms
55,788 KB
testcase_11 AC 120 ms
55,820 KB
testcase_12 AC 120 ms
55,488 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 121 ms
56,216 KB
testcase_16 AC 121 ms
56,008 KB
testcase_17 AC 121 ms
55,760 KB
testcase_18 AC 122 ms
55,908 KB
testcase_19 AC 121 ms
55,676 KB
testcase_20 AC 121 ms
55,784 KB
testcase_21 AC 122 ms
56,004 KB
testcase_22 AC 121 ms
56,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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