hihoCoder Challenge 11 register

Ended

Participants:616

Verdict:Accepted
Submitted:2015-05-03 19:05:23

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const int maxn = 500 + 10;
double a[maxn];
int n;
double dp(int x) {
    if(x == 0)
        return 1.0;
    if(a[x] != -1)
        return a[x];
    a[x] = 0;
    for(int i = 0; i < x; i++)
        for(int j = 0; j < x; j++)
            a[x] += dp(i) + dp(j);
    a[x] /= x * x;
    return a[x];
}
int main(){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX