結果
| 問題 |
No.352 カード並べ
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-06-17 21:06:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 791 bytes |
| コンパイル時間 | 733 ms |
| コンパイル使用メモリ | 69,476 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-09 16:59:47 |
| 合計ジャッジ時間 | 1,395 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <iomanip>
using namespace std;
#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)
typedef long long ll;
int main(void) {
int i, j, k, n;
double ans = 1;
cin >> n;
REP (i,2,n) {
ans += 2. / i;
double plus = 0;
int cnt = 0;
REP (j,1,i-2) {
REP (k,j+1,i-1) {
plus += j * k;
cnt++;
}
}
if (i > 2) plus = plus * (i - 2) / i / cnt;
ans += plus;
}
cout << fixed << setprecision(7) << ans << endl;
return 0;
}
h_noson