結果

問題 No.500 階乗電卓
ユーザー newlife171128
提出日時 2018-01-06 21:25:36
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 866 ms
コンパイル使用メモリ 76,232 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 03:06:28
合計ジャッジ時間 1,885 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <cctype>
#include <stdio.h>

using namespace std;

int main() {

	int n = 0;
	cin >> n;

	stringstream ss;

	long long sum = 1;
	if (n < 50) {
		for (int i = 1; i <= n; i++) {
			sum = sum * i % 10000000000000;
		}
		ss<<sum;
		string s = ss.str();
		if(sum >=1000000000000){
		s.erase(0,1);
		}
		cout<<s<<endl;
	}else {
		cout<<"000000000000"<<endl;
	}

	return 0;
}
0