UVA11310 Delivery Debacle铺砖问题

Posted 海岛Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UVA11310 Delivery Debacle铺砖问题相关的知识,希望对你有一定的参考价值。

Wolfgang Puck has two very peculiar habits:
• I. He only makes two shapes of cakes. One is square and has an area of one unit. The other is L-shaped and has an area of three units.
• II. He will only deliver cakes packed in very specific box sizes. The boxes are always 2 units wide and are of varying length.
    One day Wolfgang wondered in how many different ways he can pack his cakes into certain sized boxes. Can you help him?
在这里插入图片描述

The precise sizes of the cakes Wolfgang makes and one way to pack them in a box of length 6.
在这里插入图片描述

The five ways to pack a box of length 2.
Input
The input begins with t, the number of different box lengths. The following t lines contain an integer n (1 ≤ n ≤ 40).
Output
For each n output on a separate line the number of different ways to pack a 2-by-n box with cakes described above. Output is guaranteed to be less than 1018.
Sample Input
2
1
2
Sample Output
1
5

问题链接UVA11310 Delivery Debacle
问题简述:(略)
问题分析:铺砖问题,关键是找到递推式,不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA11310 Delivery Debacle */

#include <bits/stdc++.h>

using namespace std;

const int N = 40;
long long f[N + 1];

int main()
{
    f[0] = 1;
    f[1] = 1;
    f[2] = 5;
    for (int i = 3; i <= N; i++)
        f[i] = 2 * f[i - 3] + 4 * f[i - 2] + f[i - 1];

    int t, n;
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        printf("%lld\\n", f[n]);
    }

    return 0;
}

以上是关于UVA11310 Delivery Debacle铺砖问题的主要内容,如果未能解决你的问题,请参考以下文章

cocoalibspotify:music_delivery下播放回调时崩溃

BZOJ 2100 Apple Delivery

BADI:LE_SHP_DELIVERY_PROC-增强在交货处理中

Outlook MAPI - 无法从属性 PR_RECIPIENT_TRACKSTATUS_DELIVERY 检索数据

Woocommerce Order Delivery 插件更改显示位置

ZOJ - 3469 —— Food Delivery