結果
| 問題 |
No.352 カード並べ
|
| コンテスト | |
| ユーザー |
sugim48
|
| 提出日時 | 2016-03-11 22:46:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 657 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 79,452 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-25 01:05:30 |
| 合計ジャッジ時間 | 1,205 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
typedef long long ll;
int MOD = 1000000007;
int main() {
int N; cin >> N;
double ans = 2;
for (int x = 3; x <= N; x++) {
ans += 2.0 / x;
int cnt = 0, sum = 0;
for (int y = 1; y < x; y++)
for (int z = y + 1; z < x; z++) {
cnt++;
sum += y * z;
}
ans += (1 - 2.0 / x) * sum / cnt;
}
printf("%.15f\n", ans);
}
sugim48