Computer Transformation

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4842    Accepted Submission(s): 1769

Problem Description
A sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the computer simultaneously tranforms each digit 0 into the sequence 1 0 and each digit 1 into the sequence 0 1. So, after the first time step, the sequence 0 1 is obtained; after the second, the sequence 1 0 0 1, after the third, the sequence 0 1 1 0 1 0 0 1 and so on.
How many pairs of consequitive zeroes will appear in the sequence after n steps?
 
Input
Every input line contains one natural number n (0 < n ≤1000).
 
Output
For each input n print the number of consecutive zeroes pairs that will appear in the sequence after n steps.
 
Sample Input
2
3
 
Sample Output
1
1
做这道题,纯粹是一道大数的题,当然你需要推导出这个公式f[n]=f[n-1]+2*f[n-2];
 #include<cstdio>
const int maxn=;
int arr[maxn+][]={};
int len=;
void LargeNum()
{
arr[][]=;
for(int i=;i<=maxn;i++)
{
int c=;
for(int j=;j<len;j++)
{
arr[i][j]+=arr[i-][j]+*arr[i-][j]+c;
if(arr[i][len-]>)
len++;
c=arr[i][j]/;
arr[i][j]%=;
}
} }
int main( void )
{
int n,i;
LargeNum();
while(scanf("%d",&n)==)
{
if(n==)puts("");
else
{
for(i=len;arr[n-][i]==;i--);
for(int j=i;j>=;j--)
printf("%d",arr[n-][j]);
puts("");
}
}
return ;
}

HDUOJ-----Computer Transformation的更多相关文章

  1. HDU 1041 Computer Transformation (简单大数)

    Computer Transformation http://acm.hdu.edu.cn/showproblem.php?pid=1041 Problem Description A sequenc ...

  2. Computer Transformation(规律,大数打表)

    Computer Transformation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...

  3. hdu_1041(Computer Transformation) 大数加法模板+找规律

    Computer Transformation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...

  4. (大数)Computer Transformation hdu1041

    Computer Transformation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/ ...

  5. Computer Transformation(简单数学题+大数)

    H - Computer Transformation Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d &am ...

  6. Computer Transformation(hdoj 1041)

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

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

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

  8. UVa 1647 (递推) Computer Transformation

    题意: 有一个01串,每一步都会将所有的0变为10,将所有的1变为01,串最开始为1. 求第n步之后,00的个数 分析: 刚开始想的时候还是比较乱的,我还纠结了一下000中算是有1个00还是2个00 ...

  9. HDU 1041 Computer Transformation

    这道题目的意思是:一开始有一个数字 1 ,在接下来的时间中,计算机会按照如下规则进行扩展:                0 –> 1 0                1 –> 0 1 ...

  10. HDOJ-1041 Computer Transformation(找规律+大数运算)

    http://acm.hdu.edu.cn/showproblem.php?pid=1041 有一个初始只有一个1的串 每次都按①0 -> 10;②1 -> 01;这两条规则进行替换 形如 ...

随机推荐

  1. iOS开发-App Icons的尺寸大小

    每个App中Icon的尺寸大小是不一样的,如果你添加部分尺寸的Icon,有些没有添加,xCode会给出相应的警告,最近遇到一个问题就是A 76x76 app icon is required for ...

  2. iOS开发-UIRefreshControl下拉刷新

    下拉刷新一直都是第三库的天下,有的第三库甚至支持上下左右刷新,UIRefreshControl是iOS6之后支持的一个刷新控件,不过由于功能单一,样式不能自定义,因此不能满足大众的需求,用法比较简单在 ...

  3. 使用 AutoMapper 映射 IDataReader、DataSet、DataTable 到实体类

    AutoMapper是一个.NET的对象映射工具. 项目地址:https://github.com/AutoMapper/AutoMapper. 帮助文档:https://github.com/Aut ...

  4. Laravel Composer 脚本

    composer update --no-scripts 执行静态文件 composer dump-autoload 文件映射

  5. Android 从 Android 本地图库选择多个图片

    原文地址 本文说明如何从 Android 本地图库选择多个图片.作者考虑很多解决方案. 演示从 Android 本地图库选择多个图片,有两个方法可以实现从图库中选择多个图片: 用 Intent 获取多 ...

  6. mycat 不得不说的缘分

    .尾声.左兄与任正非.leader-us与马云 新成立的公司里面.有个左兄,非常传奇,大一在大学入伍,然后复员专业.来上海学IT.年纪轻轻,睡在地铁站,苦心专研数据库.系统.中间件,如今已经成为了业界 ...

  7. Microsoft® SQL Server® 2008 Express with Tools

    https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=22973

  8. 【转】跟我一起学Spring 3(4)–深入理解IoC(控制反转)和DI(依赖注入)

    在继续下面的章节之前,我们要先说说大名鼎鼎的IoC和DI. 我们经常会听说IoC,也就是Inversion of Controller,控制反转.事实上,IoC并不是一个新鲜的概念,最早可能是在198 ...

  9. 斯坦福《机器学习》Lesson1-3感想-------3、线性回归二

    从上一篇可知.在监督学习里最重要的就是确定假想函数h(θ),即通过使得代价函数J(θ)最小,从而确定h(θ). 上一篇通过梯度下降法求得J(θ)最小,这篇我们将使用矩阵的方法来解释. 1.普通最小二乘 ...

  10. VB.NET版+三层实现登陆

    三层已经学了一些时间了,開始认为自己能够用C#敲代码了,就用C#写了一个实现登陆的,真正再用在机房中.还是认为非常吃力的,所以.决定用vb.net敲了.以下是我用vb.net实现的登陆.能够给大家做一 ...