HDU 2200 Eddy's AC难题(组合数学)
来源:互联网 发布:如何下载bilbil软件 编辑:程序博客网 时间:2024/06/11 16:19
题目链接:HDU 2200
分析:
“从中选择一部分人(或者全部)按照ac的数量分成两组进行比较,他想使第一组中的最小ac数大于第二组中的最大ac数”
如果一共n个数从中选择m个数,共有C(n,m)种方法,选定m个数再往下分可以有m-1种分法,其中n>=m>=2.
所以f(n)=C(n,2)+C(n,3)*2+C(n,4)*3+...+C(n,n)*1
然后写出f(n+1),将其往f(n)化简可得到递推公式:f(n+1)=2*f(n)+2^n-1。打表即可。
代码:
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>using namespace std;const int maxn=100;long long ans[maxn]={0,0,1};void init(){long long tmp=4;for(int i=3;i<maxn;i++){ans[i]=2*ans[i-1]+tmp-1;tmp*=2;}}int main(){#ifdef LOCAL//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);#endif init();int n;while(cin>>n){cout<<ans[n]<<endl;}return 0;}
0 0
- HDU 2200 Eddy's AC难题(组合数学)
- HDU 2200 Eddy's AC难题(组合数学)
- hdu 2200 Eddy's AC难题(组合)
- hdu 2200 Eddy's AC难题 (数学)
- Hdoj 2200 Eddy's AC难题 【数学】
- HDOJ 2200 Eddy's AC难题(数学组合概率题)
- HDU 2200 Eddy's AC难题
- hdu 2200 Eddy's AC难题
- hdu 2200 Eddy's AC难题
- hdu-2200-Eddy's AC难题
- hdu-2200-Eddy's AC难题
- HDU ACM 2200 Eddy's AC难题
- hdu-2200 Eddy's AC难题
- HDU 2200 Eddy's AC难题 -数论
- hdu 2200 Eddy's AC难题
- hdu 2200 Eddy's AC难题
- hdu 2200Eddy's AC难题
- hdu 2200 Eddy's AC难题
- 【BLE】CC2541之OAD
- HTML学习笔记——(一)HTML简介
- python fabric模块
- 如何建立自己的技术壁垒
- Centos 6.5源码安装mysql_5.6.17
- HDU 2200 Eddy's AC难题(组合数学)
- 服务器之间建立信任关系
- Shadowsocks无法访问android主页(****.androd.com)的解决方法
- K-means算法原理与R语言实例
- 如果不小心把mysql的权限表删除了恢复方法
- hdu 3746 Cyclic Nacklace(KMP求循环节)
- 【Python】Hello World 输入输出
- UIImageView添加手势不响应的原因
- 日期差值