結果
| 問題 |
No.352 カード並べ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-12 17:30:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 630 bytes |
| コンパイル時間 | 1,880 ms |
| コンパイル使用メモリ | 194,004 KB |
| 最終ジャッジ日時 | 2025-01-19 13:53:02 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
double ret = 0;
for (int i = 1; i <= n; i++) {
double sum = 0.0;
if (i < 3)
sum = 1.0;
else {
sum += 2.0 / i;
double tmp = 0.0;
int tot = 0;
for (int x = 1; x < i; x++) {
for (int y = 1; y < x; y++) {
++tot;
tmp += x * y;
}
}
sum += (i - 2.0) / i * tmp / tot;
}
ret += sum;
}
cout << fixed << setprecision(12) << ret << endl;
return 0;
}