結果

問題 No.500 階乗電卓
ユーザー kuramubonnkuramubonn
提出日時 2023-02-04 17:29:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 1,985 ms
コンパイル使用メモリ 70,920 KB
実行使用メモリ 57,692 KB
最終ジャッジ日時 2023-09-16 14:02:47
合計ジャッジ時間 5,841 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,776 KB
testcase_01 AC 119 ms
55,464 KB
testcase_02 AC 116 ms
55,772 KB
testcase_03 AC 120 ms
55,532 KB
testcase_04 AC 117 ms
55,684 KB
testcase_05 AC 121 ms
55,876 KB
testcase_06 AC 118 ms
55,564 KB
testcase_07 AC 119 ms
55,412 KB
testcase_08 AC 121 ms
55,916 KB
testcase_09 AC 122 ms
55,476 KB
testcase_10 AC 118 ms
55,508 KB
testcase_11 AC 117 ms
55,444 KB
testcase_12 AC 118 ms
55,500 KB
testcase_13 AC 117 ms
55,980 KB
testcase_14 AC 118 ms
55,408 KB
testcase_15 AC 120 ms
56,056 KB
testcase_16 AC 118 ms
55,388 KB
testcase_17 AC 119 ms
55,580 KB
testcase_18 AC 119 ms
53,800 KB
testcase_19 AC 123 ms
55,384 KB
testcase_20 AC 124 ms
55,888 KB
testcase_21 AC 122 ms
57,692 KB
testcase_22 AC 121 ms
55,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = sc.nextLong(),data = 1;
		if(num >= 50) {
			System.out.println("000000000000");
			return;
		}
		long mod = (long)100000 * 10000000;
		for(int i = 1;i <= num ; i++) data = (((long)data % mod) * i) % (long)mod;
		if(num > 14 && String.valueOf(data).length() < 12) {
			for(int i =  String.valueOf(data).length() ; i < 12 ; i++) 
				System.out.print("0");
		}
		System.out.println(data);
	}
}
0