英语题目作业(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。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值