結果

問題 No.420 mod2漸化式
コンテスト
ユーザー kkslucy1
提出日時 2018-03-14 03:20:10
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 307 ms / 1,000 ms
+ 830µs
コード長 458 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 807 ms
コンパイル使用メモリ 180,984 KB
実行使用メモリ 9,900 KB
最終ジャッジ日時 2026-09-29 09:45:21
合計ジャッジ時間 5,957 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

ll comb(int n, int k) {
	if (n == k || k == 0) {
		return 1;
	}
	else {
		return comb(n - 1, k - 1) + comb(n - 1, k);
	}
}
int main() {
	int x;
	cin >> x;
	if (x > 31) {
		cout << 0 << ' ' << 0 << endl;
		return 0;
	}
	ll count = comb(31, x);
	ll sum = 0;
	for (int i = 0;i < 31;i++) {
		sum += pow(2, i);
	}
	sum = count * x / 31 * sum;
	cout << count << ' ' << sum << endl;

	return 0;
}
0