lightoj1014

maksyuki 发表于 oj 分类,标签:
0

1014 - Ifter Party

Now you have to find the number of piaju's each contestant ate.I have an Ifter party at the 5th day of Ramadan for the contestants. For this reason I have invited C contestants and arranged P piaju's (some kind of food, specially made for Ifter). Each contestant ate Q piaju's and L piaju's were left (L < Q).

Input

Input starts with an integer T (≤ 325), denoting the number of test cases.

Each case contains two non-negative integers P and L (0 ≤ L < P < 231).

Output

For each case, print the case number and the number of possible integers in ascending order. If no such integer is found print 'impossible'.

Sample Input

Output for Sample Input

410 013 2300 981000 997 Case 1: 1 2 5 10Case 2: 11Case 3: 101 202Case 4: impossible

 

题目类型:因子个数

算法分析:直接枚举小于sqrt(P - L)的所有因子,然后生成大于sqrt (P – L)的所有因子,注意枚举因子中的下标i必须使用long long类型,否则会RE