码迷,mamicode.com
首页 > 其他好文 > 详细

题解报告:hdu 2588 GCD

时间:2018-08-05 13:01:25      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:c代码   res   desc   esc   contain   ide   time   lin   algo   

Description

The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6. (a,b) can be easily found by the Euclidean algorithm. Now Carp is considering a little more difficult problem: Given integers N and M, how many integer X satisfies 1<=X<=N and (X,N)>=M.

Input

The first line of input is an integer T(T<=100) representing the number of test cases. The following T lines each contains two numbers N and M (2<=N<=1000000000, 1<=M<=N), representing a test case.

Output

For each test case,output the answer on a single line.

Sample Input

3
1 1
10 2
10000 72

Sample Output

1
6
260
解题思路:
AC代码:

题解报告:hdu 2588 GCD

标签:c代码   res   desc   esc   contain   ide   time   lin   algo   

原文地址:https://www.cnblogs.com/acgoto/p/9424944.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!