Title Link: http://acm.fzu.edu.cn/problem.php?pid=2147
Problem Description
Fat brother and Maze is playing a kind of special (hentai) game by, integers a and B. First Fat brother write an integer A in a white paper and then Maze start to change this integer. Every time Maze can select an integer x between 1 and A-1 then change A to A A-(a%x). The game ends when this integer is less than or equals to B. Here are the problem, at least-many times Maze needs to perform to-end this special (hentai) game.
Input
The first line of the date is a integer T, which is the number of the text cases.
Then T cases follow, each case contains the integers A and B described above.
1 <= T <=100, 2 <= B < A < 100861008610086
Output
For each case, output the case number first, and then output a integer describes the number of times Maze needs to perfor M. See the sample, input and output for more details.
Sample Input25 310086 outputcase 1:1case 2:7
Test instructions
Give the number a of two long integers, b. There is an action that changes a to: a=a-(a%x), where 1<=x<=a-1;
Ask at least how many times the operation can make a<=b.
The code is as follows:
#include <cstdio> #define LL __int64int Main () { int cas=1; LL t,a,b; scanf ("%i64d", &t); while (t--) { scanf ("%i64d%i64d", &a,&b); LL i=0; while (a>b) { a/=2; i++; } printf ("Case%d:", cas++); printf ("%i64d\n", I); } return 0;}
Problem 2147 A-B Game (math AH)