Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这道题应该是用二进制做的

Posted by hust_ELT at 2010-06-20 20:42:45 on Problem 2261
打表的也太杯具了……

#include <stdio.h>
double map[16][16];
double res[16][5];
char str[16][15];

int main()
{
	int i, j, k;
	for (i = 0; i < 16; i++)
	{
		scanf("%s", str[i]);
	}
	for (i = 0; i < 16; i++)
	{
		for (j = 0; j < 16; j++)
		{
			scanf("%lf", &map[i][j]);
			map[i][j] /= 100;
		}
		res[i][0] = 1;
	}
	for (k = 1; k < 5; k++)
	{
		for (i = 0; i < 16; i++)
		{
			for (j = 0; j < 16; j++)
			{
				if (((i ^ j) & (16 - 1<<(k - 1))) == (1<<(k - 1)))
				{
					res[i][k] += res[i][k - 1] * res[j][k - 1] * map[i][j];		
					//i,j都到第k轮,i胜了j
				}
			}
		}
	}
	for (i = 0; i < 16; i++)
	{
		printf("%-10s p=%.2lf%c\n", str[i], res[i][4] * 100, '%');
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator