結果

問題 No.500 階乗電卓
ユーザー pengin_2000
提出日時 2021-10-22 23:55:21
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 07:15:57
合計ジャッジ時間 921 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	long long int n;
	scanf("%lld", &n);
	if (n >= 50)
	{
		printf("000000000000\n");
		return 0;
	}
	long long int ans = 1, i, p = 1e12;
	for (i = 1; i <= 50 && i <= n; i++)
		ans = ans * i % p;
	if (n < 15)
		printf("%lld\n", ans);
	else
		printf("%012lld\n", ans);
	return 0;
}
0