已知gcd和lcm,求原数。。。。
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
int gcd(long long a,long long b);
int main()
{
long long int a,xya;
scanf("%lld %lld",&a,&xya);
printf("woca"); if( (long long)a == (long long)xya ){printf("woca");printf("%lld %lld",a,xya);return 0;} long long int xa,ya;
double m;
for(xa=a;xa<=xya/2;xa++){
m=xya*a/xa;
printf("woca");
if( m==m ){ ya=(long long)m;
int k=gcd(ya,xa);
if( k == a ) printf("%lld %lld\n",xa,ya);
} }
return 0;
}
int gcd(ll a,ll b){
if( a % b == 0 ) return b;
return(b,a%b);
}
longlong是否不能用啊。。。。I
#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
int gcd(long long a,long long b);
int main()
{
long long int a,xya;
scanf("%lld %lld",&a,&xya);
printf("woca"); if( (long long)a == (long long)xya ){printf("woca");printf("%lld %lld",a,xya);return 0;} long long int xa,ya;
double m;
for(xa=a;xa<=xya/2;xa++){
m=xya*a/xa;
printf("woca");
if( m==m ){ ya=(long long)m;
int k=gcd(ya,xa);
if( k == a ) printf("%lld %lld\n",xa,ya);
} }
return 0;
}
int gcd(ll a,ll b){
if( a % b == 0 ) return b;
return(b,a%b);
}
longlong是否不能用啊。。。。I