結果

問題 No.352 カード並べ
ユーザー しらっ亭しらっ亭
提出日時 2016-03-11 23:28:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,068 bytes
コンパイル時間 1,239 ms
コンパイル使用メモリ 159,136 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 05:59:41
合計ジャッジ時間 1,832 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FORR(x,arr) for(auto&& x:arr)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
typedef long long ll;
// -------------------------------------

int N;

int main() {
  cin >> N;

  if (N == 2) {
    puts("2");
    return 0;
  }

  double ans = 2;
  ll p = 1;
  ll q = 1;
  ll b = 3;
  FOR(i, 2, N) {
    //puts("----");
    ll x = p * 2;
    REP(j, i) REP(k, j) {
      //_P("%d,%d\n", j, k);
      x += (j+1) * (k+1) * q;
    }
    //_P("%lld,%lld\n", x, b);
    ans += 1.0 * x / b;
    q *= i;
    p *= (i+1);
    b *= (i+2);
  }

  _P("%.10f\n", ans);

  return 0;
}
0