二十分求助
查看原帖
二十分求助
390191
潇洒之人楼主2022/10/9 18:45
#include<bits/stdc++.h>
using namespace std;
int main(){
	double a,b,n,kkksc03,x,y,luogu=INT_MAX;
	cin>>a>>b>>n;
	kkksc03=a/b;
	for(double i=1;i<=n;i++){
		for(double j=1;j<=n;j++){
			int q=i/j;
			if(q>=kkksc03){
				int s=q-kkksc03;
				if(s<luogu){
					luogu=s;
					x=i;
					y=j;
				}
			}
		}
	}
	cout<<x<<" "<<y;
	return 0;
} ```
2022/10/9 18:45
加载中...