码迷,mamicode.com
首页 > 其他好文 > 详细

洛谷 P3802 小魔女帕琪

时间:2017-11-09 22:28:28      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:href   pac   int   gif   题目   def   none   show   nbsp   

传送门

题目大意:7个东西,每个有ai个,只有选7次

把7个东西都选到了才行。

题解:7!排列数*每次选择的概率

代码:

技术分享
#include<iostream>
#include<cstdio>
using namespace std;

double a1,a2,a3,a4,a5,a6,a7;

double sum;

int main(){
    cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7;
    sum=a1+a2+a3+a4+a5+a6+a7;
    printf("%.3lf\n",5040*a1/sum*a2/(sum-1)*a3/(sum-2)*a4/(sum-3)*a5/(sum-4)*a6/(sum-5)*a7);
    return 0;
}
AC

 

洛谷 P3802 小魔女帕琪

标签:href   pac   int   gif   题目   def   none   show   nbsp   

原文地址:http://www.cnblogs.com/zzyh/p/7811381.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!