結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2017-04-07 22:50:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,349 bytes |
コンパイル時間 | 721 ms |
コンパイル使用メモリ | 84,920 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 02:51:47 |
合計ジャッジ時間 | 1,445 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include <sstream> #include <cmath> #include <set> #include <iomanip> #include <deque> #include <stdio.h> using namespace std; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--) #define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n) #define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end()) #define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end()) #define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val)) #define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val)) #define MOD 1000000007 typedef long long ll; typedef pair<int,int> P; int main(){ ll N; cin>>N; if(N>=51){ cout<<"000000000000"<<endl; }else{ ll t = 1; for(ll i=1;i<=N;i++){ t *= i; t %= 1000000000000; } if(N<16){ cout<<t<<endl; }else{ vector<ll> ans; REP(i,12){ ans.push_back(t%10); t/=10; } reverse(ans.begin(),ans.end()); REP(i,ans.size())cout<<ans[i]; cout<<endl; } } return 0; }