编程介的小学生 2019-08-21 22:34 采纳率: 20.5%
浏览 158

火柴的问题策略计算用C语言实现

Problem Description
Matchsticks are ideal tools to represent numbers. A common way to represent the ten decimal digits with matchsticks is the following:

This is identical to how numbers are displayed on an ordinary alarm clock. With a given number of matchsticks you can generate a wide range of numbers. We are wondering what the smallest and largest numbers are that can be created by using all your matchsticks.

Input
On the first line one positive number: the number of testcases, at most 100. After that per testcase:

  • One line with an integer n (2 ≤ n ≤ 100): the number of matchsticks you have.

Output
Per testcase:

  • One line with the smallest and largest numbers you can create, separated by a single space. Both numbers should be positive and contain no leading zeroes.

Sample Input
4
3
6
7
15

Sample Output
7 7
6 111
8 711
108 7111111

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样