QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#4701. 十进制序列

Statistiques

花子了解到这样一个猜想:所有非负整数都会出现在圆周率 $\pi = 3.14159265 \dots$(圆的周长与直径之比)的无限小数位序列中。此后,每当她看到一个数字序列时,她都会尝试统计有哪些非负整数的十进制表示作为子序列出现在其中。

例如,给定序列 “3 0 1”,她发现非负整数 3、0、1、30 和 301 的表示形式都作为子序列出现在其中。

你的任务是编写一个程序,给定一个有限的数字序列,输出其中未出现的最小非负整数。在上面的例子中,0 和 1 都出现了,但 2 没有出现。因此,答案应该是 2。

输入格式

输入包含一组测试数据。

$n$ $d_1 \ d_2 \ \dots \ d_n$

$n$ 是一个正整数,表示数字的个数。每个 $d_k$ ($k = 1, \dots, n$) 都是一个数字。$d_k$ 和 $d_{k+1}$ ($k = 1, \dots, n - 1$) 之间有一个空格或换行符。

你可以假设 $1 \le n \le 1000$。

输出格式

输出序列中未出现的最小非负整数。

样例

样例输入 1

3
3 0 1

样例输出 1

2

样例输入 2

11
9 8 7 6 5 4 3 2 1 1 0

样例输出 2

12

样例输入 3

10
9 0 8 7 6 5 4 3 2 1

样例输出 3

10

样例输入 4

100
3 6 7 5 3 5 6 2 9 1 2 7 0 9 3 6 0 6 2
6 1 8 7 9 2 0 2 3 7 5 9 2 2 8 9 7 3 6
1 2 9 3 1 9 4 7 8 4 5 0 3 6 1 0 6 3 2
0 6 1 5 5 4 7 6 5 6 9 3 7 4 5 2 5 4 7
4 4 3 0 7 8 6 8 8 4 3 1 4 9 2 0 6 8 9
2 6 6 4 9

样例输出 4

11

样例输入 5

100
7 2 7 5 4 7 4 4 5 8 1 5 7 7 0 5 6 2 0
4 3 4 1 1 0 6 1 6 6 2 1 7 9 2 4 6 9 3
6 2 8 0 5 9 7 6 3 1 4 9 1 9 1 2 6 4 2
9 7 8 3 9 5 5 2 3 3 8 4 0 6 8 2 5 5 0
6 7 1 8 5 1 4 8 1 3 7 3 3 5 3 0 6 0 6
5 3 2 2 2

样例输出 5

86

样例输入 6

1
3

样例输出 6

0

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.