【构造】URAL 2004 Scientists from Spilkovo
来源:互联网 发布:淘宝卖茶叶要怎么办理 编辑:程序博客网 时间:2024/06/05 10:26
点击打开链接
求一个最短的串,使得子串能够包括0-(2^n-1)所有的二进制
构造一个欧拉回路
顾森博文:地址
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>#include<iomanip>#include<iostream>#include<queue>#include<stack>using namespace std;bool sign[1500000];int n;string answer;int main(){ while(scanf("%d",&n)!=EOF) { int temp=(1<<n)-1; memset(sign,false,sizeof(sign)); answer.clear(); sign[temp]=true; answer.insert(0,n,'1'); while(temp--) { int ans=0; for(int i=answer.length()-n+1; i<answer.length(); i++) ans=ans*2+answer[i]-'0'; int ans1=ans*2; if(!sign[ans1]) { sign[ans1]=true; answer+='0'; } else { sign[ans1+1]=true; answer+='1'; } } cout<<answer<<endl; } return 0;}
0 0
- 【构造】URAL 2004 Scientists from Spilkovo
- ural 2004. Scientists from Spilkovo 构造
- URAL 1925. British Scientists Save the World
- 【构造】URAL 1979 Resources Distribution
- Assuming easy carbon removal from the atmosphere is a high-stakes gamble, Stanford scientists say
- Mushroom Scientists
- URAL 1493. One Step from Happiness
- URAL 2015. Zhenya moves from the dormitory
- ural 1667 Square Country 3,构造
- URAL 1737 Mnemonics and Palindromes 3 构造
- URAL 1614. National Project “Trams” 构造
- Illegal spices (URAL 1995 YY构造)
- URAL 1779 The Great Team 构造题
- Ural 2045 Richness of words(构造)
- URAL 1105 Observers Coloring (构造法)
- URAL 1995 Illegal spices 贪心构造
- Ural 1040 Airline Company(构造)
- jquery构造from提交表单
- webservice(resteasy demo)
- Java中float的取值范围
- Linux 学习笔记---日志
- 输入法任意位置与大小
- TCP/IP数据包格式详解-包括数据链路层的头部
- 【构造】URAL 2004 Scientists from Spilkovo
- jdk api
- iPhone 6出现后,如何将一份设计稿支持多个尺寸?
- ios size class + autolayout在ios8以下死机和cpu占用高的问题
- openssl des 加密解密
- Linux 学习笔记---计划任务
- 那些年我们一起清除过的浮动
- 第一章---SpringMVC----MVC简介
- 灰度图像--图像分割 Canny边缘检测