結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2017-04-07 22:26:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,199 bytes |
| コンパイル時間 | 1,013 ms |
| コンパイル使用メモリ | 101,072 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 02:47:26 |
| 合計ジャッジ時間 | 1,834 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> vi;
struct edge { int v; ll w; };
const int MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
ll INF = INT_MAX;
int main() {
ll x; cin >> x;
if (x > 100) {
cout << "000000000000" << endl;
return 0;
}
ll y = 1;
rep(t, x) y = y * (t + 1) % 1000000000000LL;
double z = 1;
rep(t, x) z = z * (t + 1);
stringstream ss;
ss << y;
string s = ss.str();
if (z < 1000000000000LL) cout << s << endl;
else {
while (s.size() < 12) s = "0" + s;
cout << s << endl;
}
}
sugim48