Filling Shapes

You have a given integer nn. Find the number of ways to fill all 3×n3×n tiles with the shape described in the picture below. Upon filling, no empty spaces are allowed. Shapes cannot overlap.
在这里插入图片描述
This picture describes when n=4n=4. The left one is the shape and the right one is 3×n3×n tiles.
Input
The only line contains one integer nn (1≤n≤601≤n≤60) — the length.

Output
Print the number of ways to fill.

Examples
Input
4
Output
4
Input
1
Output
0

这个题意是用那个左边的填满右边的,右边图是一个3*n的规格。
老套路,拿笔画一画连蒙带猜发现有规律,n奇数和偶数情况不一样,然后写代码就是了。
#include
#include
using namespace std;
int main()
{
int n;
cin>>n;
if(n%2) cout<<“0”<<endl;//奇数全部填不满
else//偶数的情况
{
int k;
k=(int)pow(2,n/2);//math下的一个函数,不会可以查一下
cout<<k<<endl;
}
return 0;
}
感谢观看!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值