結果
| 問題 | No.398 ハーフパイプ(2) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-07 15:50:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 2,000 ms |
| コード長 | 1,821 bytes |
| コンパイル時間 | 1,036 ms |
| コンパイル使用メモリ | 109,160 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-06-27 15:35:37 |
| 合計ジャッジ時間 | 1,901 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
const int n = 6;
const int maxScore = (n - 2) * 100;
vector<vector<vector<long long> > > dp(n, vector<vector<long long> >(101, vector<long long>(maxScore + 1, 0)));
dp[0][0][0] = 1;
for(int i=1; i<=n; ++i)
dp[0][0][0] *= i;
for(int i=0; i<n; ++i){
vector<vector<vector<long long> > > nextDp(n, vector<vector<long long> >(101, vector<long long>(maxScore + 1, 0)));
for(int a=0; a<n; ++a){
for(int b=0; b<=100; ++b){
for(int c=0; c<=maxScore; ++c){
if(dp[a][b][c] == 0)
continue;
for(int b2=b; b2<=100; ++b2){
int c2 = c;
if(0 < i && i < n - 1)
c2 += b2;
if(i > 0 && b == b2)
nextDp[a+1][b2][c2] += dp[a][b][c] / (a + 2);
else
nextDp[0][b2][c2] += dp[a][b][c];
}
}
}
}
dp.swap(nextDp);
}
int x1, x2;
char c;
cin >> x1 >> c >> x2;
int sum = (x1 * 100 + x2) * (n - 2) / 100;
long long ans = 0;
for(int a=0; a<n; ++a){
for(int b=0; b<=100; ++b){
ans += dp[a][b][sum];
}
}
cout << ans << endl;
return 0;
}