I - Infinite Improbability Drive
I - Infinite Improbability Drive
http://codeforces.com/gym/241750/problem/I
不断构造,先填n-1个0,然后能放1就放1,最后这个序列的长度就是(1<<n)+n-1,也就是每添加1位就要匹配出来一个。
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<stack>
#include<cstring>
#define inf 2147483647
#define ls rt<<1
#define rs rt<<1|1
#define lson ls,nl,mid,l,r
#define rson rs,mid+1,nr,l,r
#define N 100010
#define For(i,a,b) for(int i=a;i<=b;i++)
#define p(a) putchar(a)
#define g() getchar() using namespace std;
int n;
int a[];
bool vis[];
int ans,t,fin; void in(int &x){
int y=;
char c=g();x=;
while(c<''||c>''){
if(c=='-')y=-;
c=g();
}
while(c<=''&&c>=''){
x=(x<<)+(x<<)+c-'';c=g();
}
x*=y;
}
void o(int x){
if(x<){
p('-');
x=-x;
}
if(x>)o(x/);
p(x%+'');
}
int main(){
freopen("infinite.in","r",stdin);
freopen("infinite.out","w",stdout);
in(n);
fin=(<<n)+n-;
a[n]=;
vis[]=;
For(i,n+,fin){
a[i]=;
t=;
ans=;
for(int j=i;j>=i-n+;j--){
ans+=t*a[j];
t<<=;
}
if(vis[ans]){
vis[ans-]=;
a[i]=;
}
else
vis[ans]=;
}
For(i,,fin)
o(a[i]);
return ; }
I - Infinite Improbability Drive的更多相关文章
- AHCI: Failed to attach drive to Port1 (VERR_GENERAL_FAILURE).
在mac操作系统下,安装VirtualBoxVm虚拟机,虚拟机里面安装wind7操作系统.在启动虚拟机的时候报错:AHCI: Failed to attach drive to Port1 (VERR ...
- vmware安装win7提示No CD-ROM drive to use:GCDROM not loaded
今天安装win7 64位的操作系统到vmware虚拟机,以为一切事如此的简单,因为自己以前经常拿vmware来装系统,结果确出现下面莫名其妙的错误: 提示说没有CD-ROM,可是我明明在vmware的 ...
- Ignite 配置更新Oracle JDBC Drive
如果使用Oracle 12C 作为Ignite 的Repository的话,在Repository Createion Wizard的配置过程中,会出现ORA-28040:No matc ...
- 网盘的选择,百度网盘、google drive 还是 Dropbox
我是国内用户,需要越过Chinawall 我使用的是一枝红杏,用着还行 如果要买,结账时输入'laod80' 一枝红杏官网:官网地址 Dropbox: 稳定,速度快 Dropbox官网:链接 操作十分 ...
- UEFI Bootable USB Flash Drive - Create in Windows(WIN7 WIN8)
How to Create a Bootable UEFI USB Flash Drive for Installing Windows 7, Windows 8, or Windows 8.1 In ...
- Create a SQL Server Database on a network shared drive
(原文地址:http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-sh ...
- Infinite loop when using cookieless session ID on Azure
If you use cookieless session ID and deploy them on Azure, you might get infinite loop when you quer ...
- 【转】Expire Google Drive Files 让Google Docs云盘共享连接在指定时间后自动失效
最近在清理Google Docs中之前共享过的文件链接,发现Google Docs多人协作共享过的链接会一直存在,在实际操作中较不灵活.正好订阅的RSS推送了Pseric写的这篇文章 - Expire ...
- vs2010 A selected drive is no longer valid
visual studio 2010重新安装添加组件,报A selected drive is no longer valid错误. 这个是由于已经安装了sp1,此时需要将sp1卸载掉,然后就可以安装 ...
随机推荐
- 1.7分布式工具配置及安装(仅供学习Xshell,VMware)
前言 最近因为换工作以及其他的一些琐事,耽误了更博时间,再加上分布式的这几个软件之前没撸过....这学习这几个工具上也花了点时间 本篇博客为后续分布式的学习提供基础的安装和配置. 首先,系统为Cent ...
- Flink 核心技术浅析(整理版)
1. Flink简介 Apache Flink是一个面向分布式数据流处理和批量数据处理的开源计算平台,它能够基于同一个Flink流执行引擎(streaming dataflow engine),提供支 ...
- 安装python的pywin32安装不了,提示找不到py3.6-32
安装python的pywin32安装不了,提示找不到py3.6-32 首先我自己的py3.6是64位版本的,这是pywin32模块的下载地址 里面有各种版本的,首先我先下了64位的3.6版本的,结果提 ...
- <HTML>页面与互联网
托管 1.数据传输:托管公司允许你在一定时间内向访问者发送的页面和数据量. 2.备份:公司是否对你的页面定期备份,从而在服务器出现硬件故障时能够恢复. 域名 www.starbuzzcoffee.co ...
- mix-blend-mode
mix-blend-mode是一个css3新增的混合color与背景元素颜色的样式,同一个元素的两个颜色不影响. mix-blend-mode: normal; //正常mix-bl ...
- 一道Python面试题:给出d = [True, False, True, False, True],请利用列表d,只用一句话返回列表[0,2,4]
看题:给出d = [True, False, True, False, True],请利用列表d,只用一句话返回列表[0,2,4] 这道题的关键是拿到True的索引值,最初我是用list的index方 ...
- centos 7.2 下 nginx 1.14.1 安装部署
Nginx1.14.1安装部署 1.环境: 所有源码在跳板机kx的/web/soft下 2.安装依赖: [root@bogon src]# yum install -y libxml2 openssl ...
- Git分支实战入门详细图解
现在我们模拟一个简单的分支和合并案例,其中工作流可供真实项目借鉴. (1)在master开展工作 (2)为新的需求创建分支 (3)在新的分支上展开工作 这时,你接到一个电话,说项目有一个严重的问题需要 ...
- 论文学习笔记--无缺陷样本产品表面缺陷检测 A Surface Defect Detection Method Based on Positive Samples
文章下载地址:A Surface Defect Detection Method Based on Positive Samples 第一部分 论文中文翻译 摘要:基于机器视觉的表面缺陷检测和分类可 ...
- L2-011 玩转二叉树 (25 分) (树)
链接:https://pintia.cn/problem-sets/994805046380707840/problems/994805065406070784 题目: 给定一棵二叉树的中序遍历和前序 ...