結果

問題 No.502 階乗を計算するだけ
ユーザー HAHAHAHAHAHA
提出日時 2017-04-30 16:42:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 166,164 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-11 23:50:07
合計ジャッジ時間 3,975 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 6 ms
4,348 KB
testcase_23 AC 3 ms
4,348 KB
testcase_24 AC 5 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 3 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 3 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 7 ms
4,348 KB
testcase_31 AC 4 ms
4,352 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 1 ms
4,348 KB
testcase_43 AC 1 ms
4,348 KB
testcase_44 AC 2 ms
4,352 KB
testcase_45 AC 1 ms
4,352 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 AC 2 ms
4,348 KB
testcase_48 AC 1 ms
4,348 KB
testcase_49 AC 1 ms
4,348 KB
testcase_50 AC 1 ms
4,352 KB
testcase_51 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

const int MOD = 1e9+7;

int main(){
	long long n,ans;
	vector<long long int> v = {
		1,76479948,27368307,888050723,661224977,261384175,547665832,
		724691727,136026497,217544623,668123525,522049725,189239124,
		917084264,358655417,462639908,99199382,97830135,141827977,
		811575797,724464507,456152084,769795511,825871994,852304035,
		217598709,624500515,423951674,814362881,256473217,586445753,
		778983779,965785236,847549272
	};
	
	cin >> n;
	if(MOD<=n){
		cout << 0 << endl;
		return 0;
	}
	
	ans = v[n/10000000];
	for(int i=n/10000000*10000000+1;i<=n;i++){
		ans = (ans*i)%MOD;
	}
	cout << ans << endl;
	return 0;
}
0