Title DescriptionDescription Enter two positive integer x0,y0 (2<=x0<100000,2<=y0<=1000000) to find the number of p,q that meet the following conditions
Conditions:
1.p,a is a positive integer
2. Require p,q to x0 for greatest common divisor, y0 as least common multiple.
Trial: The number of all possible two positive integers that satisfy the condition.
input/output format input/output
Input Format:
Two positive integers x0,y0
output Format:
A number that indicates the number of p,q that satisfy the condition
input and Output sample sample Input/output
sample Test point # #
Input Sample:3 60
Sample output:
4
idea: This problem has a small skill, because half of the answer is just the front of the upside down, so you can only enumerate to the root of the square x*y, and then the answer.
this question to use to return to beg greatest common divisor, Xin loss data is not big, otherwise will "boom", haha, joking ^_^.
The code is as follows:
1#include <stdio.h>2#include <math.h>3 intOJLD (intIintJ//Greatest Common divisor (recursive)4 { 5 if(i==0)returnJ; 6OJLD (j%i,i); 7 } 8 intMain ()9 { Ten intx,y,q,num=0, K; One inti; Ascanf"%d%d",&x,&y); -k=x*y; -q=sqrt (k); the for(i=x;i<=q;i++) - { - if(k%i==0&&OJLD (i,k/i) ==x) num++; - } +printf"%d\n", num*2); - return 0; +}
Noip2001-Universal Group Rematch-second question-greatest common divisor and least common multiple issues