# ACM/ICPC 之 暴力打表-编码

```///找到一个数字序列包含所有n位数(连续)一次且仅一次
///暴力打表
///Time:141Ms    Memory:2260k
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX 1000010

bool v[MAX];
char num[6][MAX];

int main()
{
//freopen("in.txt", "r", stdin);
for(int t = 1; t <= 6; t++)
{
//初始化
memset(v, false, sizeof(v));
int len = t-1, mod = 1;
for(int i = 1; i <= t; i++)
mod *= 10;  //mod:取模数
len += mod; //输出总数
for(int i = 0; i < t; i++)
num[t-1][i] = ‘0‘;

int cur = 0;
v[cur] = true;
for(int i = t; i < len; i++)
{
int j = 0;  //向后一位试探0-9
for(; j < 10; j++)
{
int last = (cur * 10 + j) % mod;
if(!v[last]){   //标识
cur = last;
v[cur] = true;
break;
}
}
if(j == 10){    //试探未果
num[t-1][--i]++;    //回推一位+1
v[cur] = false;     //取消已有标识
while(num[t-1][i] == ‘0‘ + 10 || v[cur+1])  //超出十进制或已标识
{
if(num[t-1][i] != ‘0‘ + 10 && v[cur + 1]){  //仅仅已标识
num[t-1][i]++;
cur++;
continue;
}
i--;    //否则继续回推+1
cur = ((num[t-1][i-t+1] - ‘0‘) * mod + cur)/10;
v[cur] = false;
num[t-1][i]++;
}
cur++;
continue;
}
else num[t-1][i] = ‘0‘ + j;
}
}

int n;
while(scanf("%d", &n), n)
printf("%s\n", num[n-1]);
return 0;
}
```

## 2016年acm icpc 青岛站(中国石油大学(华东))总结

2016年acm icpc 青岛站(中国石油大学(华东))总结 2016年11月11日,在这个传说中所谓的单身节,我们出发了,做了整整一天的车来到了青岛.不得不提一下,作为一个身处华中沿海地区的童鞋,这是我人生第一次坐了这么久的高铁(真的无聊,无聊,无聊),然后到了青岛是晚上了(挤公交车真的是一件很刺激的事情). 海风那个吹, 海水那个涌, 冻得萌新瑟瑟发抖. 也许是知道我们要来挖石油的缘故吧, 老天爷特意给了我们三天晴天. 晚上也没啥事,就这么洗洗睡了,不对还有传说中学长带领学弟剁手呢! 第二

## HDU 1012 u Calculate e【暴力打表，水】

u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46844    Accepted Submission(s): 21489 Problem Description A simple mathematical formula for e is where n is allowed to go to infini

## 2016 ACM/ICPC Asia Regional Shenyang Online 1007/HDU 5898 数位dp

odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 388    Accepted Submission(s): 212 Problem Description For a number,if the length of continuous odd digits is even and the length