思路:
这叫搜索?
难以理解
我觉得就是枚举+逼近
//By SiriusRen#include#include #include #include using namespace std;int n,recx,recy,x,y;int gcd(int a,int b){ return b?gcd(b,a%b):a;}int main(){ while(~scanf("%d%d",&x,&y)){ double temp,a,minn=66666.666; a=(double)x/y; int n=x,m=y; x=y=1; while(x<=32767&&y<=32767){ temp=(double)x/y; int p=gcd(x,y),dx=x/p,dy=y/p; if(abs(temp-a)