CodeForces - 758D(递归)

博客讲述了Alexander在学习数制转换时遇到的问题,他在将数字从十进制转换到其他数制时,用数字代替字母。他试图将一个数从某个基数n的数制转回十进制,给出n和转换后的数k,寻找最小的十进制数x,使得x转换到基数n下得到k。问题保证答案存在且不超过10^18, Alexander发现逆向枚举能找出最小的x。
摘要由CSDN通过智能技术生成
D. Ability To Convert
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English letters, so he writes any number only as a decimal number, it means that instead of the letter A he will write the number 10. Thus, by converting the number 475 from decimal to hexadecimal system, he gets 11311 (475 = 1·162 + 13·161 + 11·160). Alexander lived calmly until he tried to convert the number back to the decimal number system.

Alexander remembers that he worked with li

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值