编程介的小学生 2019-06-29 10:04 采纳率: 20.5%
浏览 186

不同进制数字之间的自由的转换的程序,要用C语言的程序设计的语言的方式应该怎么来编写的

Problem Description
Life can be taught, but sometimes simple problems are just very well hidden among difficult ones. Once identifying those simple problems you are almost on a half way of solving them as well as making one big step towards winning the contest. Just be careful, this is NOT the simplest problem!

Are you ready for that challenge?

Your task is to write a program that transforms numbers from various numeric systems to decade one (base=10).

Input
Input file consists from multiple data sets separated by one or more empty lines.

First line of each set contains definition of digit ordering for some hypothetical numerical system. All ASCII printable characters (codes greater than 0x20 (space)) are allowed to appear as digits, and they are sorted according to increased decimal value (starting from zero).

Each line of the input data set (starting from second one) is one number coded with previously defined digits. Such numbers can have multiple decade interpretations (taking different base for hypothetical system) and your task is to find sum of all possible interpretations.

Explanation: If we define digit ordering as “0123456789” possible bases are 2..10 but number “6201” can be decoded only in systems with base 7..10.

Input lines can contain white space characters on both ends which should be ignored.

Output
You are required to output one decimal number per each number from input data sets. That number represents sum of decimal representations for all valid numeric system bases.

Output data sets should be separated by one blank line.

Sample Input
0123456789
90763
1

.1>C
CC.

.1
1....

Sample Output
90763
9

60
52
353

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集