题目:http://poj.org/problem?id=2506

题解:f[n]=f[n-2]*2+f[n-1],主要是大数的相加;

以前做过了的

 #include<stdio.h>
#include<string.h> int ans[][];//ans数组的第一个下标表示瓷砖数目,第二个表示对应下的方法数
//数组是倒序存储 的
int main()
{
int n, i, j, count, b, p;
while (scanf("%d", &n) != EOF)
{
memset(ans, , sizeof(ans));
ans[][] = ;
ans[][] = ;
ans[][] = ;
if (n <= )
printf("%d\n", ans[n][]);
else
{
count = ;//count表示对应的瓷砖数目下的方法数的位数
for (i = ; i <= n; i++)
{
b = ;
p = ;
for (j = ; j < count; j++)//从个位开始每一位相加
{
p = ans[i-][j]* + ans[i-][j]+b;
ans[i][j] = p % ;
b = p / ;
}
if (b)//如果大于等于10位数加1
{
ans[i][count] = b;
count ++;
}
}
for (i = count-; i >= ; i--)//逆序输出
{
printf("%d", ans[n][i]);
}
printf("\n");
}
}
return ;
}

poj 2506 Tiling(递推 大数)的更多相关文章

  1. POJ 2506 Tiling (递推 + 大数加法模拟 )

    Tiling Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7965   Accepted: 3866 Descriptio ...

  2. poj 2506 Tiling 递推

    题目链接: http://poj.org/problem?id=2506 题目描述: 有2*1和2*2两种瓷片,问铺成2*n的图形有多少种方法? 解题思路: 利用递推思想,2*n可以由2*(n-1)的 ...

  3. PKU 2506 Tiling(递推+高精度||string应用)

    题目大意:原题链接有2×1和2×2两种规格的地板,现要拼2×n的形状,共有多少种情况,首先要做这道题目要先对递推有一定的了解.解题思路:1.假设我们已经铺好了2×(n-1)的情形,则要铺到2×n则只能 ...

  4. POJ 2506 Tiling(递推+大整数加法)

    http://poj.org/problem?id=2506 题意: 思路:递推.a[i]=a[i-1]+2*a[i-2]. 计算的时候是大整数加法.错了好久,忘记考虑1了...晕倒. #includ ...

  5. Tiling(递推+大数)

    Description In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tili ...

  6. [ACM] POJ 2506 Tiling (递归,睑板)

    Tiling Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7487   Accepted: 3661 Descriptio ...

  7. Children’s Queue HDU 1297 递推+大数

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1297 题目大意: 有n个同学, 站成一排, 要求 女生最少是两个站在一起, 问有多少种排列方式. 题 ...

  8. ACM学习历程—HDU1041 Computer Transformation(递推 && 大数)

    Description A sequence consisting of one digit, the number 1 is initially written into a computer. A ...

  9. 【hdoj_1865】1sting(递推+大数)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1865 本题的关键是找递推关系式,由题目,可知前几个序列的结果,序列长度为n=1,2,3,4,5的结果分别是 ...

  10. POJ 2478 线性递推欧拉函数

    题意: 求sigma phi(n) 思路: 线性递推欧拉函数 (维护前缀和) //By SiriusRen #include <cstdio> using namespace std; # ...

随机推荐

  1. 统计某一字段等于不同值的个数的sql语句(分享)

    本文介绍下,用一条sql语句统计某一字段等于不同值的个数,方法很独特,有需要的朋友参考下. 表t,数据:  id      type001     1001     0002     1001     ...

  2. 解决 windows2012 下无法安装 sql2008R2

    Press the Windows logo key, type control panel, and then click the Control Panel icon. Note If you a ...

  3. C++ 编写 CorelDRAW CPG 插件例子(1)—WelcomeScreen

    据我所知,这是国外论坛最早的一个例子,原贴在此:http://forum.oberonplace.com/showthread.php?t=1880&highlight=Plugins 贴上主 ...

  4. 解决Win7系统安装时“安装程序无法定位现有 系统分区,也无法创建新的系统分区”提示

    第一步:U盘启动装系统时,格式化主分区的内容后出现上面的问题 第二步:重启机器,通过U 盘启动.进入win pe系统. 第三步:把windows 7的ISO镜像解压到电脑的非系统盘的其他硬盘上.如D: ...

  5. WPF中的WebBrowser

    MainWindow.xaml.cs //新窗口事件 { Uri uri = new Uri(textBox_uri.Text); System.Windows.Forms.Integration.W ...

  6. stm32之ADC学习

    1.stm32中采用的是逐次逼近型模拟数字方式,那么什么是逐次逼近呢? 逐次逼近的方式类似于二分法,以8位数据为例:当输入一个模拟量的时候,首先取这8位数的一半,即1000 0000,与模拟量比较,大 ...

  7. [Learn Android Studio 汉化教程]第一章 : Android Studio 介绍

    注:为了看上去比较清晰这里只转载了中文 原地址:  [Learn Android Studio 汉化教程]第一章 : Android Studio 介绍 本章将引导您完成安装和设置开发环境,然后你就可 ...

  8. Linux下mail/mailx命令发送邮件

    最近看到项目中经常会用mail/mailx命令发送由java程序生成的report,比较新鲜.下面就简单介绍下mail/mailx命令用法.本文以mail命令举例(mail/mailx)效果都是一样的 ...

  9. oracle 表空间、用户名 相关语句

    一.oracle查询表空间文件所在路径 select * from dba_data_files t  where t.tablespace_name='FLW' 二.计算出表空间各相关数据 SELE ...

  10. 转载 @html.ActionLink的几种参数格式

    一 Html.ActionLink("linkText","actionName") 该重载的第一个参数是该链接要显示的文字,第二个参数是对应的控制器的方法, ...