两种!!全部AC!!
2025-06-22 10:56:04
发布于:上海
9阅读
0回复
0点赞
这里也是写了两种解法啊!!!
First One
#include <bits/stdc++.h>
//#include <iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	bool can_eat = false;
	for (int i = 0; i < 3; i++) {
		int x, y;
		cin >> x >> y;
		if ((b / y) * x >= a) {
			cout << "YES" << endl;
			can_eat = true;
			break;
		}
	}
	if (!can_eat) {
		cout << "NO" << endl;
	}
	return 0;
}
极致格式+不怕aac
Second One
#include <bits/stdc++.h>
//#include <iostream>
using namespace std;
int main() {
	int a, b, x1, y1, x2, y2, x3, y3;
	cin >> a >> b;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	
	if ((b / y1) * x1 >= a)
		cout << "YES" << endl;
	else if ((b / y2) * x2 >= a)
		cout << "YES" << endl;
	else if ((b / y3) * x3 >= a)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}
- cstdio格式
 
First One
#include <bits/stdc++.h>
//#include <cstdio>
using namespace std;
int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	bool can_eat = false;
	for (int i = 0; i < 3; i++) {
		int x, y;
		scanf("%d %d", &x, &y);
		if ((b / y) * x >= a) {
			printf("YES\n");
			can_eat = true;
			break;
		}
	}
	if (!can_eat) {
		printf("NO\n");
	}
	return 0;
}
Second One
#include <bits/stdc++.h>
//#include <cstdio>
using namespace std;
int main() {
	int a, b, x1, y1, x2, y2, x3, y3;
	scanf("%d %d \n%d %d \n%d %d \n%d %d", &a, &b, &x1, &y1, &x2, &y2, &x3, &y3);
	
	if ((b / y1) * x1 >= a)
		printf("YES\n")
	else if ((b / y2) * x2 >= a)
		printf("YES\n")
	else if ((b / y3) * x3 >= a)
		printf("YES\n")
	else
		printf("NO\n")
	return 0;
}
第一次写题解,不要喷我。
这里空空如也


有帮助,赞一个