結果

問題 No.502 階乗を計算するだけ
ユーザー fal_rndfal_rnd
提出日時 2017-04-07 23:04:14
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 491 bytes
コンパイル時間 2,346 ms
コンパイル使用メモリ 71,884 KB
実行使用メモリ 60,312 KB
最終ジャッジ日時 2023-09-23 02:31:52
合計ジャッジ時間 9,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
59,784 KB
testcase_01 AC 131 ms
55,512 KB
testcase_02 AC 132 ms
55,976 KB
testcase_03 AC 126 ms
55,780 KB
testcase_04 AC 132 ms
55,916 KB
testcase_05 AC 128 ms
56,012 KB
testcase_06 AC 127 ms
55,796 KB
testcase_07 AC 127 ms
55,624 KB
testcase_08 AC 129 ms
55,856 KB
testcase_09 AC 128 ms
55,692 KB
testcase_10 AC 130 ms
55,732 KB
testcase_11 AC 130 ms
55,704 KB
testcase_12 AC 131 ms
55,788 KB
testcase_13 AC 127 ms
55,892 KB
testcase_14 AC 127 ms
55,800 KB
testcase_15 AC 129 ms
55,716 KB
testcase_16 AC 127 ms
55,672 KB
testcase_17 AC 128 ms
55,844 KB
testcase_18 AC 129 ms
56,008 KB
testcase_19 AC 127 ms
55,688 KB
testcase_20 AC 127 ms
55,404 KB
testcase_21 AC 130 ms
55,472 KB
testcase_22 AC 135 ms
55,824 KB
testcase_23 AC 129 ms
55,860 KB
testcase_24 AC 135 ms
55,988 KB
testcase_25 AC 130 ms
55,880 KB
testcase_26 AC 135 ms
55,744 KB
testcase_27 AC 136 ms
55,600 KB
testcase_28 AC 133 ms
55,736 KB
testcase_29 AC 132 ms
55,888 KB
testcase_30 AC 139 ms
55,876 KB
testcase_31 AC 136 ms
55,788 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	
	static final Scanner s=new Scanner(System.in);
	
	static final int mod = 1000000007;
	public static void main(String[] __){
		long l=1,base=1000000006/*getBase()*/,n=s.nextLong();
		for(long i=n/mod;i>0;i--) {
			l*=base;
			l%=mod;
		}
		for(long i=n%mod;i>1;i--) {
			l*=i;
			l%=mod;
		}
		System.out.println(l);
	}
	
	static int getBase() {
		long base=1;
		for(int i=2;i<mod;i++) {
			base*=i;
			base%=mod;
		}
		return (int)base;
	}
}
0