HDU 4503 湫湫系列故事——植树节
来源:互联网 发布:rpg游戏推荐 知乎 编辑:程序博客网 时间:2024/05/17 02:25
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4503
概率题。可以这样想,其三个小朋友完全属性相同或者完全属性不同不好求。我们可以容易求得他们其中只有两个人是朋友的种类数,注意最后除以2.然后概率相减就行了。
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <algorithm>#include <stack>#include <queue>#include <map>#include <string>using namespace std;int fri[1005];int main(){#ifndef ONLINE_JUDGE freopen("in.txt","r",stdin);#endif int t; int n; scanf(" %d",&t); while(t--) { scanf(" %d",&n); for(int i=0;i<n;i++) { scanf(" %d",&fri[i]); } int total = n*(n-1)*(n-2)/6; int dif = 0; for(int i=0;i<n;i++) { dif += fri[i] * (n-fri[i]-1); } dif /=2; printf("%.3lf\n",(double)(total-dif)/total); } return 0;}
- HDU 4503 湫湫系列故事——植树节
- Hdu 4503 湫湫系列故事——植树节
- HDU 4503 湫湫系列故事——植树节
- hdu 4503 湫湫系列故事——植树节
- hdu 4503 湫湫系列故事——植树节 组合概率
- hdu 4503 湫湫系列故事——植树节
- hdu 4503 湫湫系列故事——植树节
- HDU 4503 湫湫系列故事——植树节
- hdu 4503 湫湫系列故事——植树节
- HDU ACM 4503 湫湫系列故事——植树节
- HDU 4503 湫湫系列故事——植树节(组合概率)
- HDU 湫湫系列故事——植树节
- 湫湫系列故事——植树节
- 湫湫系列故事——植树节
- HDOJ - 4503 湫湫系列故事——植树节
- 2013腾讯编程马拉松初赛第〇场(HDU 4503) 湫湫系列故事——植树节
- HDU4503 湫湫系列故事——植树节
- hdu453 湫湫系列故事——植树节
- 《操作系统实现之路》前言及内容提要
- WIndows 7 安装Microsoft .NET Framework v4.0 失败,错误HRESULT 0xc8000222解决办法
- 第四周项目一
- 脂溢性皮炎
- 类加载工具--ClassUtil
- HDU 4503 湫湫系列故事——植树节
- 在您电脑的BIOS中启用 VT-x/AMD-V 支持
- 10 xargs command example in linux
- virtualbox+ubuntu设置共享文件夹
- 在新浪sae下部署python程序数据库配置问题 an integer is required
- vim 配色方案
- ZOJ 1004 Anagrams by Stack(dfs堆栈)
- PMA学习第一章
- 老公的忏悔(看了笑S你)