Submission #97601


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int K;
vector<int> R;

vector<double> solve(int a, int b)
{
	vector<double> ans(1<<K);

	if (b-a==1)
		ans[a] = 1.;
	else
	{
		int c = a+(b-a)/2;
		vector<double> A = solve(a,c);
		vector<double> B = solve(c,b);

		for (int i=a; i<c; i++)
		for (int j=c; j<b; j++)
		{
			double p = 1/(1+pow(10.,(R[j]-R[i])/400.));
			ans[i] += p*A[i]*B[j];
			ans[j] += (1-p)*A[i]*B[j];
		}
	}
	return ans;
}

int main()
{
	cin>>K;
	R = vector<int>(1<<K);
	for(int i=0; i<1<<K; i++)
		cin>>R[i];
	vector<double> ans = solve(0,1<<K);
	for (int i=0; i<1<<K; i++)
		printf("%.10f\n", ans[i]);
	return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘std::vector<double> solve(int, int)’:
./Main.cpp:27:44: error: ‘pow’ was not declared in this scope