This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
float a, b, l;
float ans = INT32_MAX, bns = 1;
int main() {
cin >> a >> b >> l;
for (float i = 1; i <= l; i++) {
for (float j = 1; j <= l; j++) {
//注意这个__gcd只能处理整数,不能处理浮点,需要强制转换一下。
if (__gcd(int(i), int(j))) {
if (i / j >= a / b) {
if (i / j < ans / bns) {
ans = i;
bns = j;
}
cout << ans << " " << bns;
return 0;