hdu 1592 Half of and a Half(大数)
来源:互联网 发布:js验证11位手机号码 编辑:程序博客网 时间:2024/06/05 08:57
很水的一道题!题目很优美!
大数!!!!
#include<stdio.h>
#include<string.h>int num[1010][1010];
int main()
{
int i,n,j;
memset(num,0,sizeof(num));
num[0][1]=1;
for(i=1;i<1010;i++)
{
for(j=1;j<1010;j++)
{
if(j==1)
num[i][j]+=(num[i-1][j])*2+1;
else
num[i][j]+=num[i-1][j]*2;
}
for(j=2;j<1010;j++)
{
if(num[i][j-1]>9)
num[i][j]+=num[i][j-1]/10;
num[i][j-1]%=10;
}
}
while(scanf("%d",&n)!=EOF)
{
for(i=1010;i>=1;i--)
if(num[n][i]!=0)
{
printf("%d",num[n][i]);
break;
}
for(j=i-1;j>=1;j--)
printf("%d",num[n][j]);
printf("\n");
}
return 0;
}
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1592
- hdu 1592 Half of and a Half(大数)
- 杭电1592 Half of and a Half 大数
- 杭电1592Half of and a Half(大数)
- hdu 1592——Half of and a Half
- HDU 1592 Half of and a Half(高精度)
- HDU1592-Half of and a Half
- WOJ1142-Half of and a Half
- 杭电OJ题 1592 Half of and a Half 解题报告
- STRHH - Half of the half
- Half Water and Half Fire
- Reverse Second Half of a Linked List
- C++的The Big Three and A Half 是什么
- just half cup of coffee
- just half cup of coffee
- Half-Sync/Half-Async
- The Rule of Big Three and half: Copy-and-swap Idiom
- summary with him in half of year
- Detection of Half-Open (Dropped) Connections
- hdu 1114 Piggy-Bank 完全背包
- Quagga里面的宏定义
- android 检查网络连接状态实现步骤
- [leetcode刷题系列]Validate Binary Search Tree
- Vim Common Cmds:
- hdu 1592 Half of and a Half(大数)
- ExtJS之布局篇
- [JS 最简单简洁的插件] 对话框
- Windows下GCC运用
- arcgis10.1系列软件下载_GIS520论坛
- [leetcode刷题系列]Interleaving String
- Perl的die、warn、eval函数
- EGOTableViewPullRefresh下拉原理及代码详解
- [leetcode刷题系列]Unique Binary Search Trees