結果

問題 No.44 DPなすごろく
ユーザー airuai
提出日時 2016-09-18 00:39:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 355 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 54,712 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 08:22:10
合計ジャッジ時間 1,647 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
double kaijou(int a) {
	double r = 1;
	while (a > 1) {
		r *= a;
		--a;
	}
	return r;
}
int main() {
	int n;
	std::cin >> n;
	int m2;
	m2 = n / 2;
	int t1;
	double count = 0;
	for (int t2 = 0; t2 <= m2; ++t2) {
		t1 = n - 2 * t2;
		count += kaijou(t1 + t2) / (kaijou(t1) * kaijou(t2));
	}
	std::cout << (long long)count << std::endl;
}
0