其他分享
首页 > 其他分享> > 英语题目作业(6)

英语题目作业(6)

作者:互联网

原题:

Magical Number

 1000ms  131072K

描述:

We consider a natural number pp with kk digits, a1a2..ak(a1≠0)a1a2..ak¯(a1≠0), is magical only when it satisfies:

Every number composed by leading digits of pp can be divisible by the number of its digits.

More formally, ∀i∈[1,k]∀i∈[1,k],i|a1a2..ai。

For example, 123 is magical, because 1|1, 2|12, 3|123。

However,124 is not magical, because 3∤124。

Every digit can be composed with match sticks in the following ways.

What is the largest posible magical number you can compose with exactly nn match sticks?

输入:

The input contains a integer n(1≤n≤10100)n(1≤n≤10100), the number of match sticks you have .

输出:

Print the largest posible magical number xx that can be possibly composed with exactly nn match sticks.

If the number doesn't exist, print −1−1.

 (链接:https://acs.jxnu.edu.cn/problem/ICPCJX2020F)

翻译:

魔力数字

由k位数组成的自然数p,a1a2···ak(ai!=0)只有当它满足:每个由前导位数p组成的数字能被p的位数整除,我们认为它是一个魔力数字。

即∀i∈[1,k],i|a1a2..ai

例如,123是一个魔力数字,因为1|1,2|12(12能被2整除),3|123(123能被3整除)

然而,124不是个魔力数字,因为3∤124(124不能被3整除)

每个数字都能用火柴棍按下面方式摆出来。

你用n根火柴棍最大可能能拜出的魔力数字是?

输入:

输入一个整数n(1<=n<=10^100),代表你有的火柴棍;

输出:

输出最大可能的魔力数字x,可能由n根火柴棍组成。

如果数字不存在,输出-1。

标签:题目,魔力,作业,number,magical,123,124,a1a2,英语
来源: https://blog.csdn.net/m0_65788482/article/details/122642972