ICPCJX2020F Magical Number 翻译

描述:

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

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

More formally, ∀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 n match sticks?

输入:

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

输出:

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

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

样例输入:

3

样例输出:

7

样例输入:

7

样例输出:

74

样例输入:

10000

样例输出:

-1

 

原题链接:Magical Number | JXNUOJ

描述:

我们认为一个有k个数字的自然数p,a1a2..ak¯(a1≠0),是有魔法的,当它满足:

每一个由开头数字为p组成的数字可以被这个数字的位数整除。

更正式的说,∀i∈[1,k],i|a1a2..ai¯。

例如,123是有魔法的,因为1|1, 2|12, 3|123。

不过,124是没有魔法的,因为3∤124。

每一个数字都可以用火柴棒由以下方法组成。

用具体的n根火柴棒,你能组成的最大的可能有魔法的数字是什么?

输入:

输入包含一个整数n(1≤n≤10100),为你有的火柴棒的数量。

输出:

输出可能被具体的n根火柴棒组成的可能有魔法的数字x。

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值