結果
問題 | No.420 mod2漸化式 |
ユーザー |
![]() |
提出日時 | 2018-06-12 12:38:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,001 bytes |
コンパイル時間 | 896 ms |
コンパイル使用メモリ | 82,552 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 13:53:06 |
合計ジャッジ時間 | 2,095 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
#include <algorithm>#include <cmath>#include <cstdio>#include <cstring>#include <deque>#include <iostream>#include <map>#include <queue>#include <set>#include <stack>#include <string>#include <utility>#include <vector>#define p(s) cout<<(s)<<endl#define REP(i,n,N) for(ll i=n;i<N;i++)#define RREP(i,n,N) for(int i=N-1;i>=n;i--)#define CK(n,a,b) ((a)<=(n)&&(n)<(b))#define F first#define S secondtypedef long long ll;using namespace std;const int inf=1e9+7;ll x;long long comb[51][51];void combinationDP(int n) {for (int i = 0; i < n + 1; i++) {for (int j = 0; j < i + 1; j++) {if (j == 0 || i == j) comb[i][j] = 1;else comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];}}}ll ans1, ans2;int main(){cin>>x;if(x>31){cout<<0<<" "<<0<<endl;return 0;}combinationDP(40);ans1 = comb[31][x];ans2 = ((1LL<<31)-1LL) * comb[30][x-1];cout<<ans1<<" "<<ans2<<endl;return 0;}