Submission #97687


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define MP make_pair
#define debug(x) cout << #x << " is " << x << endl

using namespace std;

typedef pair<int, int> P;

int R[2000];

double calc(int p, int q){
	return 1./(1.+pow(10., (R[q]-R[p])/400.));
}

double memo[1<<11][11];
int check[1<<11][11];
double dfs(int n, int k){	// k段目でnが勝つ確率
	if(k == 0) return 1;
	if(check[n][k]) return memo[n][k];
	double sum = 0.;
	int x = n/(1<<k-1);
	int y = (x&1?x-1:x+1)*(1<<k-1);
	FOR(i, y, y+(1<<k-1)){
		sum += dfs(i, k-1)*(calc(n, i));
	}
	check[n][k] = 1;
	return memo[n][k] = dfs(n, k-1)*sum;
}

int main(){
	int K;
	cin >> K;
	rep(i, 1<<K) cin >> R[i];
	cout.setf(ios::fixed);
	cout.precision(10);
	rep(i, (1<<K)){
		cout << dfs(i, K) << endl;
	}

	return 0;
}

Submission Info

Submission Time
Task C - トーナメント
User yuusti
Language C++ (G++ 4.6.4)
Score 0
Code Size 955 Byte
Status CE

Compile Error

./Main.cpp: In function ‘double calc(int, int)’:
./Main.cpp:19:41: error: ‘pow’ was not declared in this scope