103191: [Atcoder]ABC319 B - Measure

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

Description

Score : $200$ points

Problem Statement

You are given a positive integer $N$. Print a string of length $(N+1)$, $s_0s_1\ldots s_N$, defined as follows.

For each $i = 0, 1, 2, \ldots, N$,

  • if there is a divisor $j$ of $N$ that is between $1$ and $9$, inclusive, and $i$ is a multiple of $N/j$, then $s_i$ is the digit corresponding to the smallest such $j$ ($s_i$ will thus be one of 1, 2, ..., 9);
  • if no such $j$ exists, then $s_i$ is -.

Constraints

  • $1 \leq N \leq 1000$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$N$

Output

Print the answer.


Sample Input 1

12

Sample Output 1

1-643-2-346-1

We will explain how to determine $s_i$ for some $i$.

  • For $i = 0$, the divisors $j$ of $N$ between $1$ and $9$ such that $i$ is a multiple of $N/j$ are $1, 2, 3, 6$. The smallest of these is $1$, so $s_0 = $ 1.

  • For $i = 4$, the divisors $j$ of $N$ between $1$ and $9$ such that $i$ is a multiple of $N/j$ are $3, 6$. The smallest of these is $3$, so $s_4 = $ 3.

  • For $i = 11$, there are no divisors $j$ of $N$ between $1$ and $9$ such that $i$ is a multiple of $N/j$, so $s_{11} = $ -.


Sample Input 2

7

Sample Output 2

17777771

Sample Input 3

1

Sample Output 3

11

Output

分数:200分

问题描述

给你一个正整数$N$。打印一个长度为$(N+1)$的字符串$s_0s_1\ldots s_N$,定义如下。

对于每个$i = 0, 1, 2, \ldots, N$,

  • 如果存在一个介于$1$和$9$之间的$N$的除数$j$,且$i$是$N/j$的倍数,则$s_i$是对应于最小的$j$的数字(因此$s_i$将是12,...,9之一);
  • 如果不存在这样的$j$,则$s_i$为-

约束

  • $1 \leq N \leq 1000$
  • 所有输入值都是整数。

输入

输入从标准输入以以下格式给出:

$N$

输出

打印答案。


样例输入1

12

样例输出1

1-643-2-346-1

我们将解释如何确定一些$i$的$s_i$。

  • 对于$i = 0$,$N$的介于$1$和$9$之间的除数$j$,使得$i$是$N/j$的倍数是$1, 2, 3, 4, 6$。其中最小的是$1$,所以$s_0 = $ 1

  • 对于$i = 4$,$N$的介于$1$和$9$之间的除数$j$,使得$i$是$N/j$的倍数是$3, 6$。其中最小的是$3$,所以$s_4 = $ 3

  • 对于$i = 11$,不存在$N$的介于$1$和$9$之间的除数$j$,使得$i$是$N/j$的倍数,所以$s_{11} = $ -


样例输入2

7

样例输出2

17777771

样例输入3

1

样例输出3

11

HINT

输出0~n个字符,第i个字符是最小符合要求的数字——满足i是n的约数的倍数的最小约数,不存在输出-,好像是ISBN号码?

加入题单

上一题 下一题 算法标签: