编程介的小学生 2019-12-22 19:24 采纳率: 20.5%
浏览 61

Binary String 的写法

Problem Description
Give you a binary string, you can add some 1s or 0s at any places of the string. Then the result divide by K, and the remainder should be zero. Please print string of the result, if there are more, print the one with the smallest length, if still more, print the smallest lexicographical one. If there is no such result print impossible.

Input
No more than 10 test cases. For each test case first line is a nonempty binary string whose length is no more than 20 and without leading zeros. Next line is an integer K(1 <= K <= 200).

Output
Print the result described above.

Sample Input
1000
4
11101
34
11010
70

Sample Output
1000
10101010
11010010

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
    • ¥15 MCNP里如何定义多个源?
    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏