結果

問題 No.398 ハーフパイプ(2)
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-09-01 00:37:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 1,052 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 61,928 KB
実行使用メモリ 156,740 KB
最終ジャッジ日時 2023-09-09 23:08:00
合計ジャッジ時間 6,958 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 272 ms
156,588 KB
testcase_01 AC 273 ms
156,588 KB
testcase_02 AC 273 ms
156,552 KB
testcase_03 AC 274 ms
156,540 KB
testcase_04 AC 272 ms
156,592 KB
testcase_05 AC 273 ms
156,592 KB
testcase_06 AC 279 ms
156,620 KB
testcase_07 AC 297 ms
156,608 KB
testcase_08 AC 273 ms
156,740 KB
testcase_09 AC 270 ms
156,728 KB
testcase_10 AC 270 ms
156,536 KB
testcase_11 AC 271 ms
156,588 KB
testcase_12 AC 268 ms
156,616 KB
testcase_13 AC 268 ms
156,600 KB
testcase_14 AC 269 ms
156,600 KB
testcase_15 AC 268 ms
156,680 KB
testcase_16 AC 270 ms
156,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

//dp[i][j][k][l] := i番目まの審査員まで考えて(0origin)、
//最小値がj、最大値がkで合計がlの時の場合の数。
int dp[7][110][110][610];
int main(void){
	double x; cin >> x;
	
	rep(i, 6)rep(j, 101)rep(k, 101)rep(l, 601){
		dp[i][j][k][l] = 0;//場合の数0で初期化
	}
	rep(i, 101){
		dp[0][i][i][i] = 1;//0番目の審査員まで考えた時。
	}

	rep(i, 5)rep(j, 101)rep(k, 101)rep(l, 601){
		if(dp[i][j][k][l] == 0) continue;
		rep(now, 101){
			//配るdp
			if(now < j){
				dp[i + 1][now][k][l + now] += dp[i][j][k][l];
			}else if(k < now){
				dp[i + 1][j][now][l + now] += dp[i][j][k][l];
			}else{
				dp[i + 1][j][k][l + now]   += dp[i][j][k][l];
			}
		}
	}

	ll ans = 0;
	rep(j, 101)rep(k, 101)rep(l, 601){
		double sum = l - j - k;
		if(sum == 4.0 * x){//(l - j - k) = 4 * x
			ans += dp[5][j][k][l];
		}
	}
	cout << ans << endl;
	return 0;
}
0