結果

問題 No.502 階乗を計算するだけ
コンテスト
ユーザー %20
提出日時 2017-04-08 04:53:57
言語 C(gnu17)
(gcc 15.2.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 253 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 89 ms
コンパイル使用メモリ 25,784 KB
最終ジャッジ日時 2026-02-21 23:39:31
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | a[]={1,927880474,933245637,668123525,429277690,733333339,724464507,957939114,203191898,586445753,698611116};
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:4:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         scanf("%ld",&n);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | a[]={1,927880474,933245637,668123525,429277690,733333339,724464507,957939114,203191898,586445753,698611116};
main.c:4:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         scanf("%ld",&n);
      |         ^~~~~
main.c:4:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    9 |         printf("%d",x);
      |         ^~~~~~
main.c:9:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:9:9: note: include '<stdio.h>' or provide a declaration of 'printf'

ソースコード

diff #
raw source code

a[]={1,927880474,933245637,668123525,429277690,733333339,724464507,957939114,203191898,586445753,698611116};
long n,x,i;
main(){
	scanf("%ld",&n);
	if(n<1000000007){
		x=a[n/100000000];
		for(i=n%100000000;i--;)x=x*n--%1000000007;
	}
	printf("%d",x);
}
0