結果

問題 No.500 階乗電卓
ユーザー htensaihtensai
提出日時 2019-11-17 20:44:56
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 2,708 ms
コンパイル使用メモリ 83,416 KB
実行使用メモリ 57,708 KB
最終ジャッジ日時 2023-10-25 21:28:53
合計ジャッジ時間 7,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,520 KB
testcase_01 AC 130 ms
57,532 KB
testcase_02 AC 130 ms
57,480 KB
testcase_03 AC 128 ms
57,400 KB
testcase_04 AC 129 ms
57,496 KB
testcase_05 AC 128 ms
57,500 KB
testcase_06 AC 128 ms
57,400 KB
testcase_07 AC 131 ms
57,176 KB
testcase_08 AC 131 ms
57,480 KB
testcase_09 AC 131 ms
57,448 KB
testcase_10 AC 131 ms
57,232 KB
testcase_11 AC 130 ms
57,420 KB
testcase_12 AC 131 ms
57,476 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 131 ms
57,604 KB
testcase_16 AC 130 ms
57,536 KB
testcase_17 AC 130 ms
57,708 KB
testcase_18 AC 130 ms
57,444 KB
testcase_19 AC 133 ms
57,452 KB
testcase_20 AC 131 ms
57,604 KB
testcase_21 AC 131 ms
57,472 KB
testcase_22 AC 130 ms
57,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final long MOD = 1000000000000L;
 	public static void main (String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if (n < 50) {
		    System.out.println(kaijo(n));
		} else {
		    System.out.println("000000000000");
		}
	}
	
	static long kaijo (long x) {
	    if (x <= 1) {
	        return 1;
	    } else {
	        return x * kaijo(x - 1) %  MOD;
	    }
	}
}


0