結果
| 問題 |
No.352 カード並べ
|
| コンテスト | |
| ユーザー |
__math
|
| 提出日時 | 2016-03-11 22:43:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 531 bytes |
| コンパイル時間 | 1,377 ms |
| コンパイル使用メモリ | 158,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 01:02:51 |
| 合計ジャッジ時間 | 1,733 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i = 0 ;i < (n); i++)
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
int main() {
int n; cin >> n;
double ans = 1.0;
for (int c = 2; c <= n; c++) {
double p = 2 / double(c * (c - 1));
double sum = 0;
for (int x = 1; x < c; x++) {
for (int y = 1; y < x; y++) {
sum += x * y;
}
}
ans += sum * p + 2.0 / c;
}
printf("%.15lf\n",ans);
return 0;
}
__math