poj 2506 Tiling
来源:互联网 发布:俄罗斯 核武 知乎 编辑:程序博客网 时间:2024/06/11 13:50
Tiling
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9275 Accepted: 4418
Description
In how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles?
Here is a sample tiling of a 2x17 rectangle.
Here is a sample tiling of a 2x17 rectangle.
Input
Input is a sequence of lines, each line containing an integer number 0 <= n <= 250.
Output
For each line of input, output one integer number in a separate line giving the number of possible tilings of a 2xn rectangle.
Sample Input
2812100200
Sample Output
317127318451004001521529343311354702511071292029505993517027974728227441735014801995855195223534251
大数相加问题
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <math.h>using namespace std;int a[1002][102];int b[1002];int main(){ int n,m,i,j; memset(a,0,sizeof(a)); a[0][0] = 1; a[1][0] = 1; a[2][0] = 3; b[0] = 0; //长度代表的数字个数-1(数字个数是123,就是3个) b[1] = b[2] = 0; j = 0; for(i = 3; i < 251; i++) { int temp = 0; //是否进位 for(int e = 0; e <= j; e++) { a[i][e] = (a[i-1][e]+a[i-2][e]+a[i-2][e]+temp)%10; temp = (a[i-1][e]+a[i-2][e]+a[i-2][e]+temp)/10; } if(temp == 0) { b[i] = j; } else { b[i] = ++j; a[i][j] = temp; } } while(~scanf("%d",&n)) { for(i = b[n];i >= 0; i--) { printf("%d",a[n][i]); } printf("\n"); }}代码菜鸟,如有错误,请多包涵!!
0 0
- POJ 2506 Tiling
- poj 2506Tiling
- Poj 2506 Tiling
- POJ 2506 Tiling
- POJ 2506 -TILING
- POJ 2506 Tiling
- POJ 2506:Tiling
- poj 2506 Tiling
- poj 2506 Tiling
- POJ 2506 Tiling
- poj 2506---Tiling
- POJ-2506-Tiling
- POJ 2506 Tiling
- POJ 2506 Tiling 高精度
- poj 2506 Tiling 【大数】
- poj 2506 Tiling
- poj-2506 Tiling
- poj 2506 Tiling
- 奇偶规则和非零环绕数规则
- ORACLE系统表静态数据字典,常用user视图表及其常用用法
- 《数据结构》初学者笔记
- 向下转型之简介
- C语言注意点总结
- poj 2506 Tiling
- 几种导入文件的区别
- 关于 状态机中的组合逻辑
- 将Java代码重构为Java8 Stream 风格三则示例
- poj 3461 Oulipo (KMP||hash)
- Cocos2d creator js 使用javascript制作扑克游戏
- Android Accessibility(辅助功能) 学习
- java环境变量配置及运行流程
- 20160724 包