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开发-UIScreenEdgePanGestureRecognizer实战

    UIScreenEdgePanGestureRecognizer名字很长,而且关于其文档也是少的的可怜,苹果官方给的唯一的一个属性是edges,文档中的解释是这样的: A UIScreenEdgePa ...

  2. F分布

    定义:设X1服从自由度为m的χ2分布,X2服从自由度为n的χ2分布,且X1.X2相互独立,则称变量F=(X1/m)/(X2/n)所服从的分布为F分布,其中第一自由度为m,第二自由度为n.[1] F分布 ...

  3. .NET 常用加密、解密& 数字签名算法

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...

  4. 【Python】torrentParser1.03

    #------------------------------------------------------------------------------------ # torrentParse ...

  5. 浅谈压缩感知(六):TVAL3

    这一节主要介绍一下压缩感知中的一种基于全变分正则化的重建算法——TVAL3. 主要内容: TVAL3概要 压缩感知方法 TVAL3算法 快速哈达玛变换 实验结果 总结 1.TVAL3概要 全称: To ...

  6. js获取GET参数

    自定义函数 /*-----------------实现1--------------------*/ function getPar(par){ //获取当前URL var local_url = d ...

  7. 通示jQuery实例方法,未DOM对象添加多个方法

    <script type="text/javascript"> /* * 通示jQuery实例方法,未DOM对象添加多个方法 * 用按钮做多个事件的调用 */ (fun ...

  8. Nginx IP 白名单设置

    1:ip.config 192.168.3.15 1;192.168.3.10 1;192.168.0.8 1; 2:nginx.conf #geoIP的白名单 geo $remote_addr $i ...

  9. Mavlink地面站编写之二--Mission Planner编译

    软件下载:        本文使用VS2013进行编译和改动Mission Planner,其它版本号没有尝试过. 首先下载Mission Planner源码. https://github.com/ ...

  10. Hibernate学习笔记一:项目创建与基本配置文件

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6760773.html  一:ORM ORM:对象-关系 映射. 即:把Java中有关联关系的对象,转换成关系型 ...