NCPC 2016 Fleecing the Raffle(推导)
来源:互联网 发布:广州多迪网络要交钱吗 编辑:程序博客网 时间:2024/06/03 14:47
题目:https://nanti.jisuanke.com/t/17415
题意:有n个名字在盒子中,抽奖的时候抽p个名字,你可选择作弊来提高自己的中奖几率,就是在盒子中多放些自己的名字(已有一个),求最大几率(赛下看真难懂
思路:
所有题解:NCPC 2016 Presentation of solutions - NTNU
代码:
#include<bits/stdc++.h>using namespace std;int main(){ int n,p; cin >> n >> p; double maxn = 1.0*p/(n+1),cur; for(int i = 2; ;i++) { cur = maxn*i/(i-1) * (n-p+i)/(n+i); if(cur >= maxn) maxn = cur; else break; } cout << fixed << setprecision(8) << maxn << "\n"; return 0;}
阅读全文
0 0
- NCPC 2016 Fleecing the Raffle(推导)
- Fleecing the Raffle
- ACM ICPC 2017 Warmup Contest 1 F. Fleecing the Raffle
- 2016 NCPC Game Rank(模拟)
- NCPC 2016 Game Rank(纯模拟)
- 【Codeforces】2015-2016 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2015) A Adjoin the Netwo
- 2015-2016 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2015) Adjoin the Networks (树的直径)
- NCPC 2016 A Artwork(并查集)
- NCPC 2015 A Adjoin the Networks(好题)
- ACM ICPC 2017 Warmup Contest 1 (NCPC 2016)
- 【Author : DS】(CUGB 120920训练)NCPC 2009 5AC
- uva 10250 The Other Two Trees(几何推导)
- uva - 11300 - Spreading the Wealth(数学推导,中位数)
- hdu 4762 Cut the Cake(推导+高精度)
- HDU 4586 Play the Dice(规律+推导)
- UVA 11300 Spreading the Wealth (数学推导)
- POJ 3666 Making the Grade(DP 推导)
- uva 107 The Cat in the Hat(公式推导 + log函数的应用)
- js实现星级评分(第二种实现方式)
- 深入类加载器-类加载器作用,类缓存、类加载器的层次结构、ClassLoader类介绍、代理模式之双亲委派机制
- [Haskell] CodeWars|Build a pile of Cubes
- 蓝桥杯 算法提高 排列式
- Servlet源码解析初步
- NCPC 2016 Fleecing the Raffle(推导)
- 从GitHub上下载程序到Android Studio
- 如何查看activiti api的sql语句
- HTML解析库--Jsoup的基本使用
- linux网易云音乐安装失败需要×××依赖
- CSS入门及使用02
- h5拖放
- IntelliJ IDEA IDE相关
- Linux基础练习题(4)