lucky number 多校
来源:互联网 发布:金蝶软件资产负债表 编辑:程序博客网 时间:2024/06/07 04:52
lucky number
Lucky Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1093 Accepted Submission(s): 167
Problem Description
“Ladies and Gentlemen, It’s show time! ” “A thief is a creative artist who takes his prey in style... But a detective is nothing more than a critic, who follows our footsteps...” Love_Kid is crazy about Kaito Kid , he think 3(because 3 is the sum of 1 and 2), 4, 5, 6 are his lucky numbers and all others are not. Now he finds out a way that he can represent a number through decimal representation in another numeral system to get a number only contain 3, 4, 5, 6. For example, given a number 19, you can represent it as 34 with base 5, so we can call 5 is a lucky base for number 19. Now he will give you a long number n(1<=n<=1e12), please help him to find out how many lucky bases for that number. If there are infinite such base, just print out -1.
Input
There are multiply test cases. The first line contains an integer T(T<=200), indicates the number of cases. For every test case, there is a number n indicates the number.
Output
For each test case, output “Case #k: ”first, k is the case number, from 1 to T , then, output a line with one integer, the answer to the query.
Sample Input
21019
Sample Output
Case #1: 0Case #2: 1Hint10 shown in hexadecimal number system is another letter different from ‘0’-‘9’, we can represent it as ‘A’, and you can extend to other cases.
我们一直在思考-1 的情况发现想多了,只有再10以内的数3.4.5.6才可能在任何一种进制中仍表示为3/4/5/6,而如果大于10的就像十六进制一样,不是用数字表达了。
然后是同一数用不同的进制表达,如果进制越大,转化后的数越小
0 0
- lucky number 多校
- lucky number
- Lucky Number
- Lucky Number
- lucky number
- Lucky Number
- Lucky Number
- 2014 多校07 1003 Lucky Number
- FOJ 2071 lucky number
- Lucky Number 2
- A. Nearly Lucky Number
- hdu 3346 Lucky Number
- HDU3346:Lucky Number
- A. Nearly Lucky Number
- 又见 Lucky Number
- hdu 3346 Lucky Number
- HDU 3346 Lucky Number
- HDU 4937 Lucky Number
- SPOJ 220后缀数组:求每个字符串至少出现两次且不重叠的最长子串
- Android UI之ImageView
- 编程开发中最浪费时间和资源的7个错误
- ArcSDE数据被锁定后的解锁方法
- 安卓手机怎么上facebook注册账号系统图例E9加速器分享
- lucky number 多校
- java 代码之FTP服务器下载文件
- hdu 2896 病毒侵袭(AC自动机)
- opn plmn spn
- Android Demo之旅 Activity、Service、BroadCast实现计数统计
- 『IOS』nil,NULL,NSNull的区别
- There was a problem reading this document (110).解决方案
- 【UVaOJ】127 - "Accordian" Patience
- Java线程(五):Timer和TimerTask