poj2506Tiling 此题规律:A[0]=1;A[1]=1;A[2]=3;--A[n]=A[n-1]+2*A[n-2];用大数来写,AC代码: #include<stdio.h> #include<string.h> #define MAX 300 int num[MAX][MAX]; int main() { int n; while(scanf("%d",&n)!=EOF) { memset(num,0,sizeof(num)); num[0]…
id=2506">http://poj.org/problem?id=2506 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. Input Input is a sequence of lines, each line containing an integer number 0 <…
题目:http://poj.org/problem?id=2506 题解:f[n]=f[n-2]*2+f[n-1],主要是大数的相加; 以前做过了的 #include<stdio.h> #include<string.h> ][];//ans数组的第一个下标表示瓷砖数目,第二个表示对应下的方法数 //数组是倒序存储 的 int main() { int n, i, j, count, b, p; while (scanf("%d", &n) != EOF…
Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7965 Accepted: 3866 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. Input Input is a sequence of lines,…
题目链接:id=2506">http://poj.org/problem?id=2506 本题用的java解的.由于涉及到大数问题,假设对java中的大数操作不熟悉请点这儿:链接 思路:地推公式f[i]=f[i-1]+2*f[i-2] code: import java.math.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin=new…
Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7487 Accepted: 3661 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. Input Input is a sequence of lines,…
Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7437 Accepted: 3635 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. Input Input is a sequence of lines,…