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 ...
随机推荐
- python 列表 实现队列
主要用到两个函数 list.pop() 返回并删除最后一个, 也可以 list.pop(n) list.insert(0, item)
- docker service 集群创建
docker service create /新建docker集群--name webwork /集群的名称--replicas 3/ 启动3个节点--network my-network/ netw ...
- day27-面向对象进阶
#!/usr/bin/env python # -*- coding:utf-8 -*- # ----------------------------------------------------- ...
- 织梦自增函数[field:global name=autoindex/]常见用法
看来不少朋友需要不了解这个自增函数的用法,在这里我列举一些常见的写法以及作用. [field:global name=autoindex/] !--普通打印递增的数字-- [field:globa ...
- 5个Sublime Text 的插件推荐
Sublime Text 是一个代码编辑器(Sublime Text 2是收费软件,但可以无限期试用),也是HTML和散文先进的文本编辑器.Sublime Text是由程序员Jon Skinner于2 ...
- 使用SpringBoot1.4.0的一个坑
时隔半年,再次使用Spring Boot快速搭建微服务,半年前使用的版本是1.2.5,如今看官网最新的release版本是1.4.0,那就用最新的来构建,由于部署环境可能有多套所以使用maven-fi ...
- java 3des加密问题记录
3des加密有不同的加密模式和填充模式,这个网上很多不多说了,只要保证加解密的时候加密模式和填充模式保持一致就可以了 首先对于密钥的生成,java中有2种方式: 1.第一种,采用ECB模式和不填充模式 ...
- META标签的定义与使用(一、HTTP标题信息(http-equiv))
META标签分两大部分:HTTP标题信息(http-equiv)和页面描述信息(name). 一.http-equiv类似于HTTP的头部协议,它回应给浏览器一些有用的信息,以帮助正确和精确地显示网页 ...
- Python学习笔记(六)——类和对象
1.self的用法 全面理解self 2. 继承 子类继承父类,自动拥有父类的全部方法 >>> class Animal: def run(self): print('Animal ...
- Connected Graph
Connected Graph 求n个点的无向联通图数量,\(n\leq 50\). 解 直接无向联通图做状态等于是以边点做考虑,难以去重,考虑联通对立面即不联通. 不难求出n个点的总方案数为\(2^ ...