Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这道题应该是用二进制做的打表的也太杯具了…… #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator