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 ...
随机推荐
- console.log(([])?true:false); console.log(([]==false?true:false)); console.log(({}==false)?true:false)
下面是题目的类型转换结果: Boolean([]); //true Number([]); //0 Number({}); // NaN Number(false); //0 因此: console. ...
- js设计模式——1.代理模式
js设计模式——1.代理模式 以下是代码示例 /*js设计模式——代理模式*/ class ReadImg { constructor(fileName) { this.fileName = file ...
- MySQL之explain命令解释
explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择更好的索引和写出更优化的查询语句. 使用方法,在select语句前加上explain就可以了.如: explai ...
- java.lang.Double.byteValue() 方法
java.lang.Double.byteValue() 方法(通过转换成一个字节)返回此Double为一个字节的值. 声明 以下是java.lang.Double.byteValue()方法的声明 ...
- Java 序列化和反序列化(二)Serializable 源码分析 - 1
目录 Java 序列化和反序列化(二)Serializable 源码分析 - 1 1. Java 序列化接口 2. ObjectOutputStream 源码分析 2.1 ObjectOutputSt ...
- redis 部署方式及常见特性
单机部署 redis的单机部署 如何保证redis的高并发和高可用? redis的主从复制原理?redis的哨兵原理? redis单机能承载多高并发?如果单机扛不住如何扩容扛更多的并发? redis会 ...
- violet
操作系统的发展史 1.穿孔卡片 一个计算机机房一次只能被一个卡片使用 缺点:cpu的利用率低 2.联机批处理系统 支持多用户去使用一个计算机机房 3.脱机批处理系统 告诉磁盘 提高文件的读取速度 优点 ...
- UIPageViewController看这篇就够了
先说初始化 - (UIPageViewController *)PageViewController{ if(!_PageViewController){ //书脊位置,只有在UIPageViewCo ...
- Linux fork创建子进程
1. pid_t fork(void); 功能:创建父子进程 参数:无 返回值:成功:在父进程中:返回值为子进程的PID 在子进程中:返回值为0 失败:-1 注意: 1)fork函数是用来创建进程的 ...
- mysql 查询正在执行的sql
select * from information_schema.`PROCESSLIST` where info is not null; 或者 -- use information_schema; ...