結果
問題 |
No.500 階乗電卓
|
ユーザー |
|
提出日時 | 2018-09-04 01:05:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 966 bytes |
コンパイル時間 | 799 ms |
コンパイル使用メモリ | 94,992 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 05:14:12 |
合計ジャッジ時間 | 1,590 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 16 WA * 4 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> #include <ios> // std::left, std::right #include <iomanip> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) const int inf = 1001001000; //const int mod = 1000000007; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int digitsum(int i){ int t = i; int ret = 0; while(t){ ret += t%10; t /= 10; } return ret; } long long mod = pow(10,12); long long factorial(int n){ long long ret = 1; for(int i = 1; i < n+1; i++){ ret *= i; ret %= mod; } return ret; } int main(){ int n; cin >> n; if(n < 50){ cout << setfill('0') << right << setw(12) << factorial(n) << endl; }else{ cout << "000000000000" << endl; } }