結果
| 問題 | No.398 ハーフパイプ(2) |
| コンテスト | |
| ユーザー |
purple_jwl
|
| 提出日時 | 2016-07-16 14:08:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 1,550 bytes |
| コンパイル時間 | 1,352 ms |
| コンパイル使用メモリ | 163,796 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 14:38:55 |
| 合計ジャッジ時間 | 2,147 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
using namespace std;
typedef long long ll;
const int INF = 1 << 29;
int nCr[10][10];
ll calc(vector<int> score) {
if (score.front() < 0 || 100 < score.back()) return 0;
int n = sz(score);
int r = 1;
int res = 1;
int len = sz(score);
score.eb(-1);
rep (i, len) {
if (score[i] == score[i + 1]) r++;
else {
res *= nCr[n][r];
n -= r;
r = 1;
}
}
return res;
}
int main() {
nCr[0][0] = 1;
rep (i, 10) rep(j, 10) {
if (i) nCr[i][j] += nCr[i - 1][j];
if (i && j) nCr[i][j] += nCr[i - 1][j - 1];
}
double x;
cin >> x;
ll ans = 0;
REP (i, 0, 101) REP (j, i, 101) REP (k, j, 101) {
int l = (int)(x * 4) - i - j - k;
if (k > l) continue;
ans += calc(vector<int>{i - 1, i, j, k, l, l + 1}) * i * (100 - l);
ans += calc(vector<int>{i - 1, i, j, k, l, l }) * i;
ans += calc(vector<int>{i , i, j, k, l, l + 1}) * (100 - l);
ans += calc(vector<int>{i , i, j, k, l, l});
}
cout << ans << endl;
}
purple_jwl