BestCoder Round #60 HDU5505 GT and numbers
来源:互联网 发布:唐诗逸和张傲月 知乎 编辑:程序博客网 时间:2024/05/18 03:46
GT and numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 368 Accepted Submission(s): 103
Problem Description
You are given two numbers N and M .
Every step you can get a newN in the way that multiply N by a factor of N .
Work out how many steps canN be equal to M at least.
If N can't be to M forever,print−1 .
Every step you can get a new
Work out how many steps can
If N can't be to M forever,print
Input
In the first line there is a number T .T is the test number.
In the nextT lines there are two numbers N and M .
T≤1000 , 1≤N≤1000000 ,1≤M≤263 .
Be careful to the range of M.
You'd better print the enter in the last line when you hack others.
You'd better not print space in the last of each line when you hack others.
In the next
Be careful to the range of M.
You'd better print the enter in the last line when you hack others.
You'd better not print space in the last of each line when you hack others.
Output
For each test case,output an answer.
Sample Input
31 11 22 4
Sample Output
0-11
Source
BestCoder Round #60
出题人:
如果A大于B那么显然无解。考虑把A和B分解质因数。
若B存在A没有的质因数也显然无解。对于某一个A的质因数的次数。
为了加速接近B,它一定是每次翻倍,最后一次的时候把剩下的加上。
那么答案就是最小的k使得2k∗Anum≥Bnum。
最后把每个质因数的答案max起来即可。感觉本场比赛没有trick(雾~),
我就打算加入一个很经典的trick:B可以刚好等于263,
这样就要开unsigned long long。同时我还在题目里特别提醒了
“注意M的范围”可惜仍然有很多选手没有注意。
这里我表示歉意,也希望你们以后可以更加仔细一点。
0 0
- hdu5505 GT and numbers(BestCoder Round #60)
- BestCoder Round #60 HDU5505 GT and numbers
- hdu5505 GT and numbers
- BestCoder Round #60 5505GT and numbers
- GT and numbers(BestCoder Round #60)1002
- BestCoder Round #60 GT and numbers (模拟)
- hdu 5505 GT and numbers【BestCoder Round #60】
- hdu5505 GT and numbers(贪心)
- BestCoder Round #60 GT and set (dfs)
- BestCoder Round #60 HDU5504 GT and sequence
- BestCoder Round #60 GT and sequence (排序)
- hdu5504 GT and sequence(BestCoder Round #60 )
- hdu 5504 GT and sequence【BestCoder Round #60 】
- HDU 5505 GT and numbers(对于被我无意识坑到的3个人我表示抱歉)——BestCoder Round #60
- HDU 5504 GT and sequence(排除陷阱就是正解)——BestCoder Round #60
- HDU-5108-Alexandra and Prime Numbers (BestCoder Round #19)
- hdoj-GT and numbers
- BestCoder Round #66 GTW likes gt
- LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 解决办法
- Ubuntu14.04下Python3.4启动IDLE
- Android开发学习日记
- Android 异步消息处理机制 让你深入理解 Looper、Handler、Message三者关系
- Understanding and Diagnosing Visual Tracking Systems
- BestCoder Round #60 HDU5505 GT and numbers
- Ogre的渲染流程,在渲染时材质是如何起作用的,材质加载和解析
- raw_input() 与 input() __ Python
- Node 笔记
- 丰炜(VIGOR)PLC感受:
- Struts-文件上传
- 二、IPC机制续(IPC方式)
- python IDLE入门
- Windows下Mysql5.6启动日志