编程介的小学生 2019-04-30 16:40 采纳率: 20.5%
浏览 156

计数器实现的一个问题的算法,怎么才能采用C语言的程序的编写的过程的形式实现?

Problem Description
In this problem,we need to count the number that accord with the following rule(include the input number n).Read a integer number n(1<=n<=2^31 - 1) first,then do as following ways:
(1)Do nothing, then exit the process.
(2)Add a digit to the left of it,but the digit should not bigger than the half of the original first digit.For example,from 36 to 136 is legal,but 36 to 236 is illegal because 2 is bigger than half of 3.
(3)After add the digit,continue the process,until could not add digit anymore.

Input
The first line of the input contains an integer T which means the number of test cases.Then T lines follow, each line starts with a number n(1<=n<=2^31 - 1).

Output
For each test case, you should output one line contains the number that accord with the rule start from n.

Sample Input
2
1
6

Sample Output
1
6

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求数学坐标画圆以及直线的算法
    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决