Codeforces 1182A Filling Shapes
题目链接:http://codeforces.com/problemset/problem/1182/A


思路:n为奇数时不可能完全填充,ans = 0。发现若要完全填充,每俩列可产生俩种情况,所以为 ans = 2n/2
AC代码:
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
long long quickPow(long long a,long long b){
int sum=;
while(b){
if(b&) sum=sum*a;
b>>=;
a=a*a;
}
return sum;
}
int main(){
long long n;
cin >> n;
if(n % ) cout << ;
else cout << quickPow(,n/);
return ;
}
Codeforces 1182A Filling Shapes的更多相关文章
- 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 ...
- Codeforces 1290F - Making Shapes(数位 dp)
Codeforces 题面传送门 & 洛谷题面传送门 数位 dp 好题. 首先,由于是凸包,一但向量集合确定,凸包的形态肯定就已经确定了.考虑什么样的向量集合能够组成符合条件的凸包,我们假设第 ...
- 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 ...
- 图形上下文导论(Introduction to SWT Graphics)zz
图形上下文导论(Introduction to SWT Graphics) 摘要: org.eclipse.swt.graphics包(package),包含了管理图形资源的类.只要实现了org.ec ...
- Codeforces Round #589 (Div. 2)-E. Another Filling the Grid-容斥定理
Codeforces Round #589 (Div. 2)-E. Another Filling the Grid-容斥定理 [Problem Description] 在\(n\times n\) ...
- [Codeforces 1228E]Another Filling the Grid (排列组合+容斥原理)
[Codeforces 1228E]Another Filling the Grid (排列组合+容斥原理) 题面 一个\(n \times n\)的格子,每个格子里可以填\([1,k]\)内的整数. ...
- [暴力] Educational Codeforces Round 71 (Rated for Div. 2) B. Square Filling (1207B)
题目:http://codeforces.com/contest/1207/problem/B B. Square Filling time limit per test 1 second mem ...
- e587. Filling Basic Shapes
There are two ways to fill basic shapes like lines and rectangles. The first is to use specific draw ...
随机推荐
- 【LeetCode 14】最长公共前缀
题目链接 [题解] 二分最长前缀的长度. 然后暴力把第2..n个字符串和第1个字符串的前mid个字符匹配. 还有一种比较厉害的算法. 把这n个字符串加入到字典树当中去. 然后根节点到第一个有分支的节点 ...
- [Android开发] 代码code设置9.png/9-patch 图片背景后,此view中的TextView等控件显示不正常(常见于listview中)
== 0) { convertView.setBackgroundResource(R.drawable.list_gray_9); } else { convertView.setBackgroun ...
- bzoj4403题解
[参考代码] #pragma GCC optimize(2) #include <cstdlib> #define function(type) __attribute__((optimi ...
- linux 下vi与vim区别以及vim的使用
vi与vim vi编辑器是所有Unix及Linux系统下标准的编辑器,他就相当于windows系统中的记事本一样,它的强大不逊色于任何最新的文本编辑器.他是我们使用Linux系统不能缺少的工具.由于对 ...
- Windows 驱动模型的发展历史
直接从win95/98说起,因为之前的系统基本上没有保护模式的概念,程序员可以直接修改任意内存的数据.在95/98中采用的内核开发模型是VxD(虚拟设备驱动),在dos时期,程序认为它们拥有系统的一切 ...
- IdentityServer4认证服务器集成Identity&配置持久化数据库
文章简介 asp.net core的空Web项目集成相关dll和页面文件配置IdnetityServer4认证服务器 Ids4集成Identity Ids4配置持久化到数据库 写在最前面,此文章不详细 ...
- 5. Python数据类型之元组、集合、字典
元组(tuple) 元组创建很简单,只需要在小括号中添加元素,并使用逗号隔开即可.与列表不同的是,元组的元素不能修改.如下代码所示: tup1 = () tup2 = (1) tup3 = (1,) ...
- inode缓存与dentry缓存
1. inode缓存 1: struct inode { 2: /* RCU path lookup touches following: */ 3: umode_t i_mode; 4: uid_t ...
- Codeforces 1191A Tokitsukaze and Enhancement
题目链接:http://codeforces.com/problemset/problem/1191/A 思路:枚举 16 种情况输出最高的就行. AC代码: #include<bits/std ...
- 拾遗:使用 systemd-journald 管理 Docker 容器日志
在 docker.service 文件中的 ExecStart 字段中,添加(或:docker run --log-driver=journald): --log-driver=journald \ ...