結果

問題 No.500 階乗電卓
ユーザー tansunogon
提出日時 2017-05-05 16:31:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 63,616 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 03:00:24
合計ジャッジ時間 1,276 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

struct iostream_init_struct
{ 
	iostream_init_struct()
	{
		std::cin.tie(0);
		std::cin.sync_with_stdio(false);
	}
} iostream_init;

int main(void)
{
	long long N;
	cin >> N;

	if (N >= 50)
	{
		cout << "000000000000" << endl;
		return 0;
	}

	long long ans = 1;
	for (int i = 2; i <= N; ++i)
	{
		ans = (ans * i) % 1000000000000LL;
	}
	if (N >= 15)
	{
		printf("%012lld\n", ans);
	}
	else
	{
		cout << ans << endl;
	}
	return 0;
}
0