Hat's Fibonacci
http://acm.hdu.edu.cn/showproblem.php?pid=1250
大数斐波那契
%08d是什么东西,为什么我用flag交不上,唉,不刷大数了,没劲。暑假再讲。
就是交不上
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
int ta[][];
int main()
{
int n,k;
memset(ta,,sizeof(ta));
ta[][]=;
ta[][]=;
ta[][]=;
ta[][]=;
ta[][]=;
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
k=ta[i][j]+ta[i-][j]+ta[i-][j]+ta[i-][j]+ta[i-][j];
if(k>=)
{
ta[i][j+]=k/;
ta[i][j]=k%;
}
else ta[i][j]=k;
} }
while(scanf("%d",&n)!=EOF)
{
int i,j;
for(i=;i>=;i--)
if(ta[n][i]!=) break;
printf("%d",ta[n][i]);
for(j=i-;j>=;j--)
printf("%05d",ta[n][j]);//5个字符宽度的整数,不够5个的左边用0补齐
printf("\n");
}
return ;
}
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2876
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
int ta[][];
int main()
{
int n,k;
memset(ta,,sizeof(ta));
ta[][]=;
ta[][]=;
ta[][]=;
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
k=ta[i][j]+ta[i-][j]+ta[i-][j];
if(k>=)
{
ta[i][j+]=k/;
ta[i][j]=k%;
}
else ta[i][j]=k;
} }
int T;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
int i,j;
for(i=;i>=;i--)
if(ta[n][i]!=) break;
printf("%d",ta[n][i]);
for(j=i-;j>=;j--)
printf("%05d",ta[n][j]);//5个字符宽度的整数,不够5个的左边用0补齐
printf("\n");
}
return ;
}
Hat's Fibonacci的更多相关文章
- hdu 1250 Hat's Fibonacci
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1250 Hat's Fibonacci Description A Fibonacci sequence ...
- Hat's Fibonacci(大数,好)
Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Hat's Fibonacci(大数加法+直接暴力)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1250 hdu1250: Hat's Fibonacci Time Limit: 2000/1000 M ...
- (二维数组 亿进制 或 滚动数组) Hat's Fibonacci hdu1250
Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDUOJ----1250 Hat's Fibonacci
Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- HDU 1250 Hat's Fibonacci(大数相加)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1250 Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Ot ...
- HDU 1250 Hat's Fibonacci (递推、大数加法、string)
Hat's Fibonacci Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1250 Hat's Fibonacci(高精度数)
// 继续大数,哎.. Problem Description A Fibonacci sequence is calculated by adding the previous two membe ...
- HDOJ/HDU 1250 Hat's Fibonacci(大数~斐波拉契)
Problem Description A Fibonacci sequence is calculated by adding the previous two members the sequen ...
- HDU1250:Hat's Fibonacci
Problem Description A Fibonacci sequence is calculated by adding the previous two members the sequen ...
随机推荐
- 【转载】.NET 开发者必备的工具箱
本文作者Spencer是一名专注于ASP.NET和C#的程序员,他列举了平时工作.在家所使用的大部分开发工具,其中大部分工具都是集中于开发,当然也有一些其它用途的,比如图片处理.文件压缩等. 如果你是 ...
- Android Studio 删除 Module
1.选中Module右击,选择 Open Module Settings,打开Project Structure 窗空.(或者选中Module,按F4打开Project Structure窗口) 2. ...
- Window 命令行神器:cmder
http://cmder.net/ https://github.com/cmderdev/cmder/releases/ 官网下载地址 http://www.360doc.com/content ...
- 外网电脑配置8G运行内存,运行Android Studio,速度很轻松
Win 7系统 之前RAM是 4 G,运行Android studio ,再运行浏览器或办公软件时卡的一比.再插入一个 4G内存条,总共8G时,速度嗖的一下就上来了.
- 如何使用Countifs函数动态统计
我们以前就是一个函数一个功能,一个函数一个区域,这次我们使用动态函数.我们先写好条件范围,因为我们要引用. 同样的我们写下函数出来,我们先把Countifs写出来.选择完区域之后如下图. 条件 ...
- 重建索引:ALTER INDEX..REBUILD ONLINE vs ALTER INDEX..REBUILD
什么时候需要重建索引 1. 删除的空间没有重用,导致 索引出现碎片 2. 删除大量的表数据后,空间没有重用,导致 索引"虚高" 3.索引的 clustering_facto 和表不 ...
- 题目1461:Tempter of the bone(深度优先遍历DFS)
题目链接:http://ac.jobdu.com/problem.php?pid=1461 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...
- LeetCode 11 Container With Most Water(分支判断问题)
题目链接 https://leetcode.com/problems/container-with-most-water/?tab=Description Problem: 已知n条垂直于x轴的线 ...
- [Offer收割]编程练习赛15 B.分数调查[加权并查集]
#1515 : 分数调查 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi的学校总共有N名学生,编号1-N.学校刚刚进行了一场全校的古诗文水平测验. 学校没有公布测 ...
- ELK系列二:Elasticsearch的架构原理和配置优化
1.Elasticsearch的数据组织架构 1.1.Elasticsearch结构概念 集群(cluster):拥有相同cluster-name的elasticsearch结点的集合(每个结点其实就 ...