链接:

https://codeforces.com/contest/1182/problem/A

题意:

You have a given integer n. Find the number of ways to fill all 3×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=4. The left one is the shape and the right one is 3×n tiles.

图片复制不了

思路:

给定形状只能再n为偶数的情况下完全覆盖,所以奇数不用考虑,同时,每两列为一组,一组有两种。

答案就是2^(n/2)。

代码:

#include <bits/stdc++.h>
using namespace std; int main()
{
int n;
cin >> n;
int res = 1;
if (n%2 == 1)
cout << 0 << endl;
else
{
for (int i = 1;i <= n/2;i++)
res *= 2;
cout << res << endl;
} return 0;
}

Codeforces Round #566 (Div. 2) A. Filling Shapes的更多相关文章

  1. Codeforces Round #566 (Div. 2)

    Codeforces Round #566 (Div. 2) A Filling Shapes 给定一个 \(3\times n\) 的网格,问使用 这样的占三个格子图形填充满整个网格的方案数 如果 ...

  2. Codeforces Round #566 (Div. 2)题解

    时间\(9.05\)好评 A Filling Shapes 宽度为\(3\),不能横向填 考虑纵向填,长度为\(2\)为一块,填法有两种 如果长度为奇数则显然无解,否则\(2^{n/2}\) B Pl ...

  3. Codeforces Round #566 (Div. 2) C. Beautiful Lyrics

    链接: https://codeforces.com/contest/1182/problem/C 题意: You are given n words, each of which consists ...

  4. Codeforces Round #566 (Div. 2) B. Plus from Picture

    链接: https://codeforces.com/contest/1182/problem/B 题意: You have a given picture with size w×h. Determ ...

  5. Codeforces Round #589 (Div. 2) B. Filling the Grid

    链接: https://codeforces.com/contest/1228/problem/B 题意: Suppose there is a h×w grid consisting of empt ...

  6. Product Oriented Recurrence(Codeforces Round #566 (Div. 2)E+矩阵快速幂+欧拉降幂)

    传送门 题目 \[ \begin{aligned} &f_n=c^{2*n-6}f_{n-1}f_{n-2}f_{n-3}&\\ \end{aligned} \] 思路 我们通过迭代发 ...

  7. Codeforces Round #566 (Div. 2)C(字符串,SET)

    #include<bits/stdc++.h>using namespace std;string s[100007];set<int>st[100007][7];int t[ ...

  8. Codeforces Round #589 (Div. 2) Another Filling the Grid (dp)

    题意:问有多少种组合方法让每一行每一列最小值都是1 思路:我们可以以行为转移的状态 附加一维限制还有多少列最小值大于1 这样我们就可以不重不漏的按照状态转移 但是复杂度确实不大行(减了两个常数卡过去的 ...

  9. Codeforces Round #633 (Div. 2)

    Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...

随机推荐

  1. Hadoop- 流量汇总程序之如何实现hadoop的序列化接口及代码实现

    流量汇总程序需求 统计每一个用户(手机号)锁耗费的总上行流量.下行流量.总流量. 流程剖析 阶段:map 读取一行数据,切分字段, 抽取手机号,上行流量,下行流量 context.write(手机号, ...

  2. SpringMVC拦截器的配置与使用详解

         一.SpringMVC拦截器简介      Spring MVC的处理器拦截器类似于Servlet开发中的过滤器Filter,用于对处理器进行预处理和后处理.在springmvc中,定义拦截 ...

  3. BaseServlet优化Servlet,实现类似struts2的一些简单效果

    package cn.itcast.web.servlet; import java.io.IOException; import javax.servlet.ServletException; im ...

  4. jsp日期插件My97DatePicker 强大的日期控件 使用方便简单(转)

    本文属转载(希望对编程爱好者有所帮助)详情请访问官方网站 http://www.my97.net/dp/index.asp 一. 简介 1. 简介 目前的版本是:4.7 2. 注意事项 My97Dat ...

  5. Thread,Service和AsyncTask

    Thread,Service和AsyncTask这三种东西,似乎都是用来执行后台耗时操作的: 印象里Service是「超过5s的耗时操作就应该放进去」,但是Service实际上仍然是主线程,所以,在S ...

  6. PHP 流程控制

    流程控制 if, else, elseif $a = 5; $b = 9; if ($a > $b): echo "a is bigger than b"; elseif ( ...

  7. codevs 4939 欧拉函数

    传送门 4939 欧拉函数  时间限制: 1 s  空间限制: 1000 KB  题目等级 : 钻石 Diamon     题目描述 Description 输入一个数n,输出小于n且与n互素的整数个 ...

  8. bzoj 1731 [Usaco2005 dec]Layout 排队布局——差分约束

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1731 对差分约束理解更深.还发现美妙博客:http://www.cppblog.com/me ...

  9. JQuery Mobile+cordova构建一个Android项目

    1.安装Android开发环境     Android开发环境的安装,现在主要是由于不能访问谷歌站点,在windows下在host文件中添加一个对应的74.125.195.190 dl-ssl.goo ...

  10. java 基础知识学习 内存泄露(memory leak) VS 内存溢出(out of memory)以及内存管理

    内存泄露(memory leak) VS 内存溢出(out of memory) 内存溢出 out of memory,是指程序在申请内存时,没有足够的内存空间供其使用,出现out of memory ...