結果

問題 No.500 階乗電卓
ユーザー subsn
提出日時 2023-06-13 16:40:05
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 01:58:38
合計ジャッジ時間 901 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdint.h>
int main()
{
	uint64_t n = 0;
	uint64_t ans = 1;
	scanf("%llu", &n);
	uint64_t m = n;
	if (!n) ans = 0;
	if (n > 49) {
		printf("000000000000\n");
		return 0;
	}
	while (n) {
		ans *= n--;
		ans %= 1000000000000;
	}
	if(m >= 15)printf("%012llu\n", ans);
	if(m < 15)printf("%llu\n",ans);
}
0