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 ...
随机推荐
- Unicode与MultiByte之间的练习: Process Cleaner
#include <cstdio> #include <cstring> #include <windows.h> #include <tlhelp32.h& ...
- getmapping等无法解析
版本要改一下,4.1.6没有<dependency> <groupId>org.springframework</groupId> <artifactId&g ...
- Scrapy的初体验
上一节安装了python2和python3的开发环境 首先第一步:进入开发环境,workon article_spider 进入这个环境: 安装Scrapy,在安装的过程中出现了一些错误:通常这些错误 ...
- Ngui之UI框架的层级处理
#region 处理层级问题 void DepthIncrease(UIWndBase uiWnd) { DepthIncrease(uiWnd.transform, UIFlag); } publi ...
- scala容器对象(转载)
1Array 数组 Scala的数组是这个样子: val arr = new Array[String](3) 程序员们基本都看得懂,new 一个Array对象,它的类型是String,长度为3.对元 ...
- uoj33 【UR #2】树上GCD
题目 大致是长剖+\(\rm dsu\ on\ tree\)的思想 先做一个转化,改为对于\(i\in[1,n-1]\)求出有多少个\(f(u,v)\)满足\(i|f(u,v)\),这样我们最后再做一 ...
- ES6 学习 -- Class继承
(1)如何继承Class可以通过extends关键字实现继承,如下:class Father { } class Child extends Father { }// 这里子类Child继承父类Fat ...
- 2018-8-10-win10-uwp-如何让一个集合按照需要的顺序进行排序
title author date CreateTime categories win10 uwp 如何让一个集合按照需要的顺序进行排序 lindexi 2018-08-10 19:16:50 +08 ...
- ionic js ion-tabs选项卡栏操作
ionic 选项卡栏操作 ion-tabs ion-tabs 是有一组页面选项卡组成的选项卡栏.可以通过点击选项来切换页面. 对于 iOS,它会出现在屏幕的底部,Android会出现在屏幕的顶部(导航 ...
- DEV的GridControl控件的选中列属性设置高光
设置Run Designer=>Views=> OptionsSelection下面的: EnableAppearanceFocusedCell = False,//鼠标移开,失去焦点,仍 ...