AC

你加钠了吗  •  3天前


include <bits/stdc++.h>

using namespace std;

int main() {

double a, b, l, max1 = 1e9, maxn = 0;
cin >> a >> b >> l;
double x = a / b;
for (double i = 1; i <= l; i++) {
	for (double j = 1; j <= l; j++) {
		if (i / j * 1.0 >= x) {
			if (i / j * 1.0 - x < max1 - x) {
				max1 = i / j;
				maxn = j;
			}
		}
	}
}
cout << max1 *maxn << " " << maxn;

}


评论:

请先登录,才能进行评论