为防止广告,目前nocow只有登录用户能够创建新页面。如要创建页面请先登录/注册(新用户需要等待1个小时才能正常使用该功能)。
UVA/694
来自NOCOW
< UVA
输入数据以
-1 -1 结尾
每组有两个数A,L。
若A=1那么就停止。
若A是偶数,那么将A除以二。
若A是奇数,就将A乘3加1。
若A由偶数变为奇数时,将A乘3加1,再将A除以二,直到A是1为止。
但A不得超L。
目录 |
[编辑] Sample Input
3 100
34 100
75 250
27 2147483647
101 304
101 303
-1 -1
[编辑] Sample Output
Case 1: A = 3, limit = 100, number of terms = 8
Case 2: A = 34, limit = 100, number of terms = 14
Case 3: A = 75, limit = 250, number of terms = 3
Case 4: A = 27, limit = 2147483647, number of terms = 112
Case 5: A = 101, limit = 304, number of terms = 26
Case 6: A = 101, limit = 303, number of terms = 1
[编辑] ==========================================
路人甲提示:中间运行时变量可能大于 int。