Codeforces Parking Lot
http://codeforces.com/problemset/problem/630/I
简单的排列组合,推式子技巧:举一个小样例,看着推,别抽象着推,容易错
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#define inf 2147483647
#define N 1000010
#define p(a) putchar(a)
#define For(i,a,b) for(long long i=a;i<=b;++i) using namespace std;
long long n;
void in(long long &x){
long long y=;char c=getchar();x=;
while(c<''||c>''){if(c=='-')y=-;c=getchar();}
while(c<=''&&c>=''){ x=(x<<)+(x<<)+c-'';c=getchar();}
x*=y;
}
void o(long long x){
if(x<){p('-');x=-x;}
if(x>)o(x/);
p(x%+'');
} long long ksm(long long a,long long b){
long long r=;
while(b>){
if(b&)
r=r*a;
a=a*a;
b>>=;
}
return r;
} int main(){
in(n);
o((*n-)*ksm(,n-));
return ;
}
Codeforces Parking Lot的更多相关文章
- Codeforces 46D Parking Lot
传送门 D. Parking Lot time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #135 (Div. 2) E. Parking Lot 线段数区间合并
E. Parking Lot time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- ●CodeForces 480E Parking Lot
题链: http://codeforces.com/problemset/problem/480/E题解: 单调队列,逆向思维 (在线的话应该是分治做,但是好麻烦..) 离线操作,逆向考虑, 最后的状 ...
- Codeforces 219E Parking Lot 线段树
Parking Lot 线段树区间合并一下, 求当前要占的位置, 不包括两端点的写起来方便一点. #include<bits/stdc++.h> #define LL long long ...
- Codeforces 480.E Parking Lot
E. Parking Lot time limit per test 3 seconds memory limit per test 256 megabytes input standard inpu ...
- Parking Lot CodeForces - 480E
大意: 给定01矩阵, 单点赋值为1, 求最大全0正方形. 将询问倒序处理, 那么答案一定是递增的, 最多增长$O(n)$次, 对于每次操作暴力判断答案是否增长即可, 也就是说转化为判断是否存在一个边 ...
- Codeforces Round#415 Div.2
A. Straight «A» 题面 Noora is a student of one famous high school. It's her final year in school - she ...
- CF 480 E. Parking Lot
CF 480 E. Parking Lot http://codeforces.com/contest/480/problem/E 题意: 给一个n*m的01矩阵,每次可以将一个0修改为1,求最大全0 ...
- Codeforces Round #127 (Div. 1) B. Guess That Car! 扫描线
B. Guess That Car! 题目连接: http://codeforces.com/contest/201/problem/B Description A widely known amon ...
随机推荐
- 20140404 OpencvGPU模块 参考文献交叉引用:引用->题注 加入3.1,3.2,3.2编号
1.参考文献交叉引用:引用->题注 2.加入3.1,3.2,3.2编号:开始->段落 3.OpencvGPU模块,编译opencv.sln时记得在库目录中添加D:\opencv\build ...
- Slow HTTP POST慢速攻击
测试工具 模拟测试工具:slowhttptest https://github.com/shekyan/slowhttptest 安装: https://github.com/shekyan/slow ...
- 协方差及matlib绘制
转自http://www.cnblogs.com/chaosimple/p/3182157.html 一.统计学的基本概念 统计学里最基本的概念就是样本的均值.方差.标准差.首先,我们给定一个含有n个 ...
- scrapy的使用-scrapy shell
进入 该目录下执行scrapy shell 文件, 在命令行可执行该文件中链接的xpath语法,和BeautifulSoup语法.
- WebService接口测试
- java编程——数据的加法
设计思想: 第一步:从键盘上输入一定个数的整数. 第二步:因为在main()方法中的参数是String类型的,所以第一步中输入的其实是字符类型,在这一步要把String转化成int. 第三步:初始化s ...
- C# 调用java的Webservice时关于非string类型处理
比如webservice地址是:http://wdft.com:80/services/getOrderService1.0?wsdl 方法是:getOrder 1.首先添加引用: 2. 3.引用完成 ...
- 那些年,我们见过的 Java 服务端“问题”
导读 明代著名的心学集大成者王阳明先生在<传习录>中有云: 道无精粗,人之所见有精粗.如这一间房,人初进来,只见一个大规模如此.处久,便柱壁之类,一一看得明白.再久,如柱上有些文藻,细细都 ...
- linux如何查看防火墙是否开启?删除iptables规则
iptables是linux下的防火墙组件服务,相对于windows防火墙而言拥有更加强大的功能,此经验咗嚛以centos系统为例.关于iptables的一般常见操作,怎么来判断linux系统是否启用 ...
- Http学习(三)
HTTP的问题: 通信使用明文,可能会遭到窃听:HTTP本身不具备加密功能,根据TCP/IP协议工作的线路上可能会遭到窃听,即使通信内容已经加密,也会被看到 通信加密:通过SSL(Secure Soc ...