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. svg image标签降级技术

    1.svg image标签降级技术: svg不能很好的在anroid2.3中得到支持,需要额外的补充,IE8-以及Android 2.3默认浏览器是不支持SVG的. svg image标签降级技术,这 ...

  2. 命令行修改mysql密码和远程访问

    http://jingyan.baidu.com/article/a3a3f8118cea488da2eb8a0a.html

  3. Introduction to the visual formatting model

    原文:https://www.w3.org/TR/CSS2/visuren.html#block-formatting --------------------------------------- ...

  4. Java-JUC(十):线程按序交替执行

    问题: 有a.b.c三个线程,使得它们按照abc依次执行10次. 实现: package com.dx.juc.test; import java.util.concurrent.locks.Cond ...

  5. Linux echo 显示内容颜色

    Linux echo 显示内容颜色 https://www.cnblogs.com/kimbo/p/6816566.html #字体颜色:30m-37m 黑.红.绿.黄.蓝.紫.青.白 str=&qu ...

  6. 转: 一个程序员的Java和C++学习之路(整理)

    http://blog.csdn.net/ajian005/article/details/8003655 http://m.blog.csdn.net/xugangwen/article/detai ...

  7. 解决Ubuntu/debian的Apt-get 由于依赖关系安装失败的问题

    The following packages have unmet dependencies: libssl-dev: Depends: libssl0.9.8 (= 0.9.8k-7ubuntu8) ...

  8. 浅谈压缩感知(九):正交匹配追踪算法OMP

    主要内容: OMP算法介绍 OMP的MATLAB实现 OMP中的数学知识 一.OMP算法介绍 来源:http://blog.csdn.net/scucj/article/details/7467955 ...

  9. (纪录片)数学的故事 The Story of Maths (2008)

    简介: 导演: Robin Dashwood编剧: Marcus du Sautoy主演: Marcus du Sautoy类型: 纪录片官方网站: www.bbc.co.uk/programmes/ ...

  10. C#.NET常见问题(FAQ)-如何使用2D绘图控件ZedGraph绘制坐标轴和坐标曲线

    添加数据:示例添加了一条sin曲线和一条cos曲线,注意cos曲线比sin曲线点更密集(可以用这种方式控制点的采样疏密程度)   默认显示效果如下图所示,可以框选一个部分看放大效果   右击某个点可以 ...