結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2022-08-08 00:57:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 1,881 ms |
コンパイル使用メモリ | 193,156 KB |
最終ジャッジ日時 | 2025-01-30 19:21:14 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; const ll MOD=1e12; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n; cin>>n; if(n>=60){ cout<<"000000000000"<<endl; return 0; } ll ans=1; bool b=false; for(ll i=1;i<=n;i++){ ans*=i; if(ans>=MOD) b=true; ans%=MOD; } if(b) cout<<setfill('0')<<right<<setw(12)<<ans<<endl; else cout<<ans<<endl; return 0; }