201292: [AtCoder]ARC129 C - Multiple of 7

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $500$ points

Problem Statement

Given is an integer $N$.

Find one string $s$ consisting of 1, 2, $\cdots$, 9 that satisfies the conditions below.

  • The length of $s$, $|s|$, is at most $10^6$.
  • There are exactly $N$ pairs of integers $(l,r)$ ($1 \leq l \leq r \leq |s|$) that satisfy the following condition.
    • When the $l$-th through $r$-th characters of $s$ are extracted and seen as a number, it is divisible by $7$.

Under the Constraints of this problem, we can prove that a solution always exists.

Constraints

  • $1 \leq N \leq 10^6$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$

Output

Print a string $s$ that satisfies the conditions. If multiple solutions exist, printing any of them would be accepted.


Sample Input 1

2

Sample Output 1

142

Two pairs $(l,r)=(1,2),(2,3)$ satisfy the conditions.


Sample Input 2

3

Sample Output 2

77

Three pairs $(l,r)=(1,1),(2,2),(1,2)$ satisfy the conditions.

Input

题意翻译

给定 $N$,请构造一个长度不超过 $10^6$,且仅包含 1~9 的字符串 $s$,使其恰好有 $N$ 对 $(l,r)(1\leq l\leq r\leq |s|)$ 满足 $s$ 的第 $l$ 到第 $r$ 个字符顺次拼接组成的数是 7 的倍数。 输出任意一组解即可。

加入题单

上一题 下一题 算法标签: