阿牛的EOF牛肉串 hdu2047 递推
来源:互联网 发布:淘宝有趣便宜小玩意 编辑:程序博客网 时间:2024/06/05 20:55
http://acm.hdu.edu.cn/showproblem.php?pid=2047
除了想一想那个递推公式耗费一点儿时间,其余的狠简单。
这个就是假设n=□□□□□□有f(n)种不同的串,当第n个是o时,那么第n-1个不能为o,此种情况有f(n-2)*2个
当第n个不是o时,有f(n-1)*2个;
即f(n)=f(n-1)*2+f(n-2)*2;
#include <iostream>using namespace std;#define N 45__int64 method[N];void init(){method[0]=1;method[1]=3;int i;for (i=2;i<N;i++)method[i]=(method[i-1]+method[i-2])*2;}int main(){int n;init();while (scanf("%d",&n)!=EOF)printf("%I64d\n",method[n]);return 0;}
- 阿牛的EOF牛肉串 hdu2047 递推
- HDU2047 阿牛的EOF牛肉串 【数学递推】
- HDU2047 阿牛的EOF牛肉串【递推】
- hdu2047阿牛的EOF牛肉串
- HDU2047:阿牛的EOF牛肉串
- hdu2047 阿牛的EOF牛肉串
- hdu2047阿牛的EOF牛肉串
- HDU2047 阿牛的EOF牛肉串
- HDU2047 阿牛的EOF牛肉串
- HDU2047-阿牛的EOF牛肉串
- hdu2047 阿牛的EOF牛肉串
- HDU2047阿牛的EOF牛肉串
- hdu2047 阿牛的EOF牛肉串
- hdu2047阿牛的EOF牛肉串
- HDU2047阿牛的EOF牛肉串
- hdu2047阿牛的EOF牛肉串
- HDU2047 阿牛的EOF牛肉串
- HDU2047 阿牛的EOF牛肉串
- Qt中Qstring,char,int,QByteArray之间到转换
- JavaScript探秘:强大的原型和原型链
- mstsc VS vnc : 远程桌面最快的原因在于RDP协议
- Java annotation 自定义注释@interface的用法
- C++ Vector(向量容器)
- 阿牛的EOF牛肉串 hdu2047 递推
- App_Code 文件夹在vs2010中Web Application找不到
- 爆笑如雷的笑话分享
- my quick sort
- 迷宫
- Bluetooth Core Architecture Blocks (蓝牙核心架构)(一)
- 挑战编程 程序设计竞赛训练手册-1.6.3 旅行(The Trip)
- hbernate学习(三)一对一双向关联
- 敏捷日志2013-1-21