|
/*八重轮回何止暴力也! */#define LOCAL#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<cstdlib>#include< 淘宝如何刷信誉;iomanip>#include<string>#include<algorithm> #include<ctime>#include<stack>#include<queue>#include<vector>#define N 10005using namespace std;int main(){#ifdef LOCAL freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);#endif int i,j,a,b,c,d,e,f,g,h,defender,attacker,point[9][50];double pro[9][50],sum; memset(point,0,sizeof(point)); for(a=1;a<=6;a++) //累计各个数目(1-8)的骰子涌现各个点数的次数 { for(b=1;b<=6;b++) { for(c=1;c<=6;c++) { for(d=1;d<=6;d++) { for(e=1;e<=6;e++) { for(f=1;f<=6 淘宝店刷流量;f++) { for(g=1;g<=6;g++) { for(h=1;h<=6;h++) { point[8][a+b+c+d+e+f+g+h]++; } point[7][a+b+c+d+e+f+g]++; } point[6][a+b+c+d+e+f]++; } point[5][a+b+c+d+e]++; } point[4][a+b+c+d]++; } point[3][a+b+c]++; } point[2][a+b]++; } point[1][a]++; } for(i=1;i<=8;i++)//计算各个数量(1-8)的骰子呈现各个点数的概率 { for(j=1;j<=6*i;j++) { pro[j]=point[j]/pow(6.0,i); } } while(~scanf("%d%d",&attacker,&defender)) { sum=0; for(i=1;i<=6*attacker;i++)//盘算累计概率 留神第二个for循环的把持 for(j=1;j<(i<(defender*6+1)?idefender*6+1));j++) sum+=pro[attacker]*pro[defender][j]; printf("%.16lf\n",sum); } return 0;}
s9.com.cn |
|