求改成pyhton代码
  • 板块灌水区
  • 楼主Lian_zy
  • 当前回复5
  • 已保存回复5
  • 发布时间2024/4/5 17:57
  • 上次更新2024/4/5 20:14:16
查看原帖
求改成pyhton代码
923248
Lian_zy楼主2024/4/5 17:57

rt,懒得写高精度了

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int maxn = 1e3 + 10;
struct node {
	int a, b;
} a[maxn];
int n, y, ans, mul[maxn];
bool cmp(node x, node y) {
	return x.a * x.b < y.a * y.b;
}
int main() {
	scanf("%d %d %d", &n, mul, &y);
	for (int i = 1; i <= n; i++) scanf("%d %d", &a[i].a, &a[i].b);
	sort(a + 1, a + n + 1, cmp);
	for (int i = 1; i <= n; i++) {
		mul[i] = mul[i - 1] * a[i].a;
		ans = max(ans, mul[i - 1] / a[i].b);
	}
	printf("%d\n", ans); 
	return 0;
}
2024/4/5 17:57
加载中...