Codeforces Round #566 (Div. 2) A. Filling Shapes
链接:
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的更多相关文章
- Codeforces Round #566 (Div. 2)
Codeforces Round #566 (Div. 2) A Filling Shapes 给定一个 \(3\times n\) 的网格,问使用 这样的占三个格子图形填充满整个网格的方案数 如果 ...
- Codeforces Round #566 (Div. 2)题解
时间\(9.05\)好评 A Filling Shapes 宽度为\(3\),不能横向填 考虑纵向填,长度为\(2\)为一块,填法有两种 如果长度为奇数则显然无解,否则\(2^{n/2}\) B Pl ...
- Codeforces Round #566 (Div. 2) C. Beautiful Lyrics
链接: https://codeforces.com/contest/1182/problem/C 题意: You are given n words, each of which consists ...
- 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 ...
- 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 ...
- 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} \] 思路 我们通过迭代发 ...
- Codeforces Round #566 (Div. 2)C(字符串,SET)
#include<bits/stdc++.h>using namespace std;string s[100007];set<int>st[100007][7];int t[ ...
- Codeforces Round #589 (Div. 2) Another Filling the Grid (dp)
题意:问有多少种组合方法让每一行每一列最小值都是1 思路:我们可以以行为转移的状态 附加一维限制还有多少列最小值大于1 这样我们就可以不重不漏的按照状态转移 但是复杂度确实不大行(减了两个常数卡过去的 ...
- Codeforces Round #633 (Div. 2)
Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...
随机推荐
- listen 76
Flavors Fluctuate With Temperature Does an ice-cold drink actually taste better than the same bevera ...
- LinkedList_1.打印两个有序链表的公共部分
思路: 实例化出两个链表($link_a, $link_b),比较连个链表当前元素的大小,谁小谁执行next()方法继续比较,当出现相当的时候把相等的值塞入数组$common里,当两个链表有一个元素比 ...
- swift的arc 是不是有问题?
class Arctest { let name: String = "Arctest" @lazy var ret:() -> String? = { [weak self ...
- 1131 Subway Map(30 分)
In the big cities, the subway systems always look so complex to the visitors. To give you some sense ...
- python2.7 爬虫初体验爬取新浪国内新闻_20161130
python2.7 爬虫初学习 模块:BeautifulSoup requests 1.获取新浪国内新闻标题 2.获取新闻url 3.还没想好,想法是把第2步的url 获取到下载网页源代码 再去分析源 ...
- html制作细线表格
关于这个细线表格的制作方法,百度一下可能就会有答案告诉你设置这几个值:给table设置border="0" cellspacing="1" bgcolor=&q ...
- ACM学习历程——HDU3333 Turing Tree(线段树 && 离线操作)
Problem Description After inventing Turing Tree, 3xian always felt boring when solving problems abou ...
- 【C++】*p++ = *p不同环境下操作不同
实测,Ubuntu16.04,gcc 5.3.0&5.4.0(编译选项选择C++11和不选择新标准结果相同) #include<iostream> using namespace ...
- windwos 10 谷歌浏览器出现彩色闪条
应该是上个星期五开始,发现电脑从别的地方切换到谷歌浏览器就会出现闪条,开始也没太注意,但是到周一还是这样,所以再网上查了下, 说什么的都有,什么你按脑屏幕坏了,内存条不行什么是的.后来才发现原来是谷歌 ...
- Ubuntu环境下对拍
何为对拍 假设我在考场上写了一个能过样例的算法.然后它也能过大样例但是我觉得有些担心某些细节会出错,或者是它连大样例都过不了但是大样例过大无法肉眼差错,这个时候我们就需要对拍了. 所谓对拍,就是对着拍 ...