結果

問題 No.502 階乗を計算するだけ
ユーザー WA_TLEWA_TLE
提出日時 2017-04-07 23:12:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 542 ms / 1,000 ms
コード長 729 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 26,012 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-23 02:37:25
合計ジャッジ時間 5,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<stdio.h>
long long int itiok=100000000;
int main(void){
	long long int i=1,N,ans=1,gen=0,ok=0;
	scanf("%lld",&N);
	if(N<10*itiok+7){
		
		if(N>itiok){
			i+=itiok;
			ans=927880474;
		}
		if(N>2*itiok){
			i+=itiok;
			ans=933245637;
		}
		if(N>3*itiok){
			i+=itiok;
			ans=668123525;
		}
		if(N>4*itiok){
			i+=itiok;
			ans=429277690;
		}
		if(N>5*itiok){
			i+=itiok;
			ans=733333339;
		}
		if(N>6*itiok){
			i+=itiok;
			ans=724464507;
		}
		if(N>7*itiok){
			i+=itiok;
			ans=957939114;
		}
		if(N>8*itiok){
			i+=itiok;
			ans=203191898;
		}
		if(N>9*itiok){
			i+=itiok;
			ans=586445753;
		}
		for(;i<=N;i++){
			ans*=i;
			ans%=1000000007;
		}
		printf("%lld\n",ans);
	} else{
		printf("0\n");
	}
	return 0;
}
0