結果

問題 No.420 mod2漸化式
ユーザー gigime
提出日時 2016-09-09 23:19:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 651 bytes
コンパイル時間 1,639 ms
コンパイル使用メモリ 158,176 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 11:15:28
合計ジャッジ時間 2,774 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

ll X;
ll memo [50] [50];

ll nCr(ll n,ll r)
{
	if(n == 0 && r == 0) return 1;
	else if(memo [n] [r]) return memo [n] [r];

	ll res = 0;
	if(n - 1 >= 0 && r - 1 >= 0){
		res += nCr(n - 1,r - 1);
	}
	if(n - 1 >= 0 && n - 1 >= r){
		res += nCr(n - 1,r);
	}

	return memo [n] [r] = res;
}

int main()
{
	cin >> X;

	if(X > 31){
		cout << 0 << ' ' << 0 << endl;
		return 0;
	}

	cout << nCr(31,X) << ' ' << nCr(31,X) * X / 31 * INT_MAX << endl;

	return 0;
}
0